Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Regarding ADO+


Message #1 by "SATHISH C.G." <cgs@s...> on Wed, 20 Dec 2000 09:54:34 +0530
This is a multi-part message in MIME format.



------=_NextPart_000_004D_01C06A6A.DB46C5E0

Content-Type: text/plain;

	charset="x-user-defined"

Content-Transfer-Encoding: quoted-printable



Hi,



    I have some problem in accessing the data through ado+.I tried to 

access the sysobjects table through ADOCommand , Adodatasetreader and 

tried to print all the data's.It gave me null execption.



CODE: -



<%@ import namespace "System.ADO"%>

<%@ import namespace "System.Data"%>



<Script langauge=3D"VB" Runat=3D"Server">



DIm Adocmd as ADOCommand

Dim adord as AdoDatasetreader

Dim cnstr as String

Sub Page_Load(Sender as Object,E as EventArgs)

cnstr=3D"Provider=3Dsqloledb;user id=3Dsa;pwd;database=3Dmaster"

Adocmd=3Dnew AdoCommand("select * from sysobjects",cnstr)

Adocmd.Activeconnection.open()

Adocmd.execute(adord)

While adord.read()

console.writeln(adord.item("name")) 

End While

End Sub



</Script>



Please give me a good solution to access the records from the database 

through the above specified ado+ objects.



Regards



SATHISH C.G.





---

http://www.asptoday.com - the leading site for timely,

in-depth information for ASP developers everywhere.

---

You are currently subscribed to aspx as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-aspx-$subst('Recip.MemberIDChar')@p2p.wrox.com








Message #2 by "dave" <support@1...> on Wed, 20 Dec 2000 07:40:02 -0600
This is a multi-part message in MIME format.



------=_NextPart_000_058E_01C06A58.1014D180

Content-Type: text/plain;

	charset="x-user-defined"

Content-Transfer-Encoding: quoted-printable



hi S,

I'm assuming you are trying to do this through webpage, and not a client 

application....

here is the modified code that ran for me on Beta1

:

<%@ import namespace=3D"System.Data.ADO"%>

<%@ import namespace=3D"System.Data"%>

<%@ page debug=3D"true" %>

<Script langauge=3D"VB" Runat=3D"Server">



DIm Adocmd as ADOCommand

Dim adord as AdoDatareader

Dim cnstr as String

Sub Page_Load(Sender as Object,E as EventArgs)

cnstr=3D"data source=3D(local);Provider=3Dsqloledb;user 

id=3Dsa;pwd=3D;database=3Dmaster"

Adocmd=3Dnew AdoCommand("select * from sysobjects",cnstr)

Adocmd.Activeconnection.open()

Adocmd.execute(adord)

While adord.read()

response.write(adord.item("name")) 

End While

End Sub



</Script>



Also, if you are accessing sql server, then you really want to use the 

Data.SQL namespace rather than the Data.ADO.



here is an example to loop through a "recordset" using the Data.SQL 

provider:

<%@import namespace=3D"system.data.SQL"%>

<script language=3D"vb" runat=3D"server">

Sub Page_Load(sender As Object, e As EventArgs)



Dim sqlText as String =3D "select * from authors"

Dim cnString as string =3D 

"server=3Dsql.myserver.com;uid=3Dpubs;pwd=3Dpubs;database=3Dpubs;"

Dim dbRead AS SQLDataReader

Dim sqlCmd AS SQLCommand



sqlCmd =3D New SQLCommand(sqlText,cnString)

sqlCmd.ActiveConnection.Open()



sqlCmd.execute(dbread)



while dbRead.Read()



response.write("<br>" & dbRead.Item("au_lname"))



End while



End Sub

</script>



Quite a few contributor to the ASP.NET directory have submitted code 

samples for connecting to various datasources... you may want to search 

the code library there at

http://www.123aspx.com/searchs.asp



Cheers!

dave

http://www.123aspx.com

The Largest ASP.NET Web Directory!



  ----- Original Message -----

  From: SATHISH C.G.

  To: ASP+

  Sent: Tuesday, December 19, 2000 10:24 PM

  Subject: [aspx] Regarding ADO+





  Hi,



      I have some problem in accessing the data through ado+.I tried to 

access the sysobjects table through ADOCommand , Adodatasetreader and 

tried to print all the data's.It gave me null execption.



  CODE: -



  <%@ import namespace "System.ADO"%>

  <%@ import namespace "System.Data"%>



  <Script langauge=3D"VB" Runat=3D"Server">



  DIm Adocmd as ADOCommand

  Dim adord as AdoDatasetreader

  Dim cnstr as String

  Sub Page_Load(Sender as Object,E as EventArgs)

  cnstr=3D"Provider=3Dsqloledb;user id=3Dsa;pwd;database=3Dmaster"

  Adocmd=3Dnew AdoCommand("select * from sysobjects",cnstr)

  Adocmd.Activeconnection.open()

  Adocmd.execute(adord)

  While adord.read()

  console.writeln(adord.item("name")) 

  End While

  End Sub



  </Script>



  Please give me a good solution to access the records from the database 

through the above specified ado+ objects.



  Regards



  SATHISH C.G.

  ---

  http://www.asptoday.com - the leading site for timely,

  in-depth information for ASP developers everywhere.



  To unsubscribe send a blank email to leave-aspx-$subst('Recip.MemberIDChar')@p2p.wrox.com







---

http://www.asptoday.com - the leading site for timely,

in-depth information for ASP developers everywhere.

---

You are currently subscribed to aspx as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-aspx-$subst('Recip.MemberIDChar')@p2p.wrox.com








Message #3 by "SATHISH C.G." <cgs@s...> on Thu, 21 Dec 2000 09:43:19 +0530
This is a multi-part message in MIME format.



------=_NextPart_000_0013_01C06B32.739A4200

Content-Type: text/plain;

	charset="x-user-defined"

Content-Transfer-Encoding: quoted-printable



Thanks for the solution.I will just try it out and i will mail back you 

again.



Cheers



SATHISH C.G





  ----- Original Message -----

  From: dave

  To: ASP+

  Sent: Wednesday, December 20, 2000 7:10 PM

  Subject: [aspx] Re: Regarding ADO+





  hi S,

  I'm assuming you are trying to do this through webpage, and not a 

client application....

  here is the modified code that ran for me on Beta1

  :

  <%@ import namespace=3D"System.Data.ADO"%>

  <%@ import namespace=3D"System.Data"%>

  <%@ page debug=3D"true" %>

  <Script langauge=3D"VB" Runat=3D"Server">

  

  DIm Adocmd as ADOCommand

  Dim adord as AdoDatareader

  Dim cnstr as String

  Sub Page_Load(Sender as Object,E as EventArgs)

  cnstr=3D"data source=3D(local);Provider=3Dsqloledb;user 

id=3Dsa;pwd=3D;database=3Dmaster"

  Adocmd=3Dnew AdoCommand("select * from sysobjects",cnstr)

  Adocmd.Activeconnection.open()

  Adocmd.execute(adord)

  While adord.read()

  response.write(adord.item("name")) 

  End While

  End Sub

  

  </Script>

  

  Also, if you are accessing sql server, then you really want to use the 

Data.SQL namespace rather than the Data.ADO.

  

  here is an example to loop through a "recordset" using the Data.SQL 

provider:

  <%@import namespace=3D"system.data.SQL"%>

  <script language=3D"vb" runat=3D"server">

  Sub Page_Load(sender As Object, e As EventArgs)



  Dim sqlText as String =3D "select * from authors"

  Dim cnString as string =3D 

"server=3Dsql.myserver.com;uid=3Dpubs;pwd=3Dpubs;database=3Dpubs;"

  Dim dbRead AS SQLDataReader

  Dim sqlCmd AS SQLCommand



  sqlCmd =3D New SQLCommand(sqlText,cnString)

  sqlCmd.ActiveConnection.Open()



  sqlCmd.execute(dbread)



  while dbRead.Read()



  response.write("<br>" & dbRead.Item("au_lname"))



  End while



  End Sub

  </script>

  

  Quite a few contributor to the ASP.NET directory have submitted code 

samples for connecting to various datasources... you may want to search 

the code library there at

  http://www.123aspx.com/searchs.asp

  

  Cheers!

  dave

  http://www.123aspx.com

  The Largest ASP.NET Web Directory!



    ----- Original Message -----

    From: SATHISH C.G.

    To: ASP+

    Sent: Tuesday, December 19, 2000 10:24 PM

    Subject: [aspx] Regarding ADO+





    Hi,



        I have some problem in accessing the data through ado+.I tried 

to access the sysobjects table through ADOCommand , Adodatasetreader and 

tried to print all the data's.It gave me null execption.



    CODE: -



    <%@ import namespace "System.ADO"%>

    <%@ import namespace "System.Data"%>

    

    <Script langauge=3D"VB" Runat=3D"Server">

    

    DIm Adocmd as ADOCommand

    Dim adord as AdoDatasetreader

    Dim cnstr as String

    Sub Page_Load(Sender as Object,E as EventArgs)

    cnstr=3D"Provider=3Dsqloledb;user id=3Dsa;pwd;database=3Dmaster"

    Adocmd=3Dnew AdoCommand("select * from sysobjects",cnstr)

    Adocmd.Activeconnection.open()

    Adocmd.execute(adord)

    While adord.read()

    console.writeln(adord.item("name")) 

    End While

    End Sub

    

    </Script>



    Please give me a good solution to access the records from the 

database through the above specified ado+ objects.



    Regards



    SATHISH C.G.





---

http://www.asptoday.com - the leading site for timely,

in-depth information for ASP developers everywhere.

---

You are currently subscribed to aspx as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-aspx-$subst('Recip.MemberIDChar')@p2p.wrox.com









  Return to Index