Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ado problemem new to .Net

Status
Not open for further replies.

testare

Programmer
Jan 21, 2005
127
Today i sat down to for the first time to look at Visual Basic .Net
I Notice that my Set is being disappear when i type
Code:
Set Conn = CreateObject("ADODB.Connection")
becuase then i want to use a recordet set
Code:
Dim Conn As ADODB.Connection
Dim Rec As ADODB.Recordset
Dim sSQL As String

Conn = CreateObject("ADODB.Connection")
Conn.ConnectionString = "Driver{SQLServer};Server=TEST;UID=sa;PWD=123;DATABASE=TEST"
Conn.Open()

sSQL = "SELECT * FROM USER"

Rec = Conn.Execute(sSQL)
 
VB .NET does not use the Set command.

If you are going to make the switch to VB .NET, you should go all the way and swithc to ADO .NET as well. This means no Recordsets. To do what you are doing in ADO .NET, try this (note, this assumes you are using SQL Server):

First, at the top of your code, put this:

Imports System.Data.SqlClient

Then:

Dim Conn As SQLConnection
Dim da As SQLDataAdapter
dim ds As DataSet

Conn = New SqlConnection("Server=TEST;Integrated Security=SSPI;DATABASE=TEST")
Conn.Open()

da = New SqlDataAdapter("SELECT * FROM USER" ,Conn)
ds = New DataSet
da.Fill(ds, "User")

Google for "ADO .NET Tutorial" and you should get some resources to help you progress in understanding the new technology.


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
jebenson: thank you.
I need to read a Visual Basic .Net book.
 
If you want a very good quick start I would recomend going to microsoft's webcast website.

It is full of great demos and explanations of how to do it right.

Check out.
MSDN Webcast: The Power of Effective Data Access Techniques (Session 8)—What ADO.NET Can Do For You—Level 200

and for a list of great webcasts on dotnet in general, look over the options in the "Developer" secion of



You will need a Passport account and you need to sign in..

I tend to go for the "PreRecorded" or "OnDemand" webcasts as I can watch them when I have a spare moment. But they are FULL of goood information.


HTH


Rob

PS each webcast is about 1 hr long.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top