|
-
Oct 7th, 2002, 03:47 PM
#1
Thread Starter
New Member
ADOConnection not found
VB.NET
-----------------------------------------------------
I can't access to my access database via ado.net.
When I type in :
ADOConnection adoConnection = new ADOConnection()
the keyword ADOConnection is underlined, and can't be found!!
So, what shall I do?
to import something??
I've looked at so many examples of database accessing with ado.net in the internet, but nothing works!!
Perhaps you could give me some examples, how i could access to an access db called login, with one table 'login' and there i want to update the field username where id = 3, for example!!!
thx for your help!
-
Oct 8th, 2002, 05:37 AM
#2
Frenzied Member
First off, your syntax looks a bit like C++/C#; you can't declare variables like that in VB.Net. Can you?
Second, I don't know if there is an ADOConnection object in ADO.Net I've never seen it, but then again, I'm very new to .NET
The example below might start you off:
VB Code:
Imports System.Data.OleDb
Public Class DataAccess
Public Sub test()
Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\test.mdb")
Dim cmd As New OleDbCommand("SELECT * FROM tblPlayers", cnn)
Dim da As New OleDbDataAdapter()
Dim ds As New DataSet()
'open the connection
cnn.Open()
'set the dataadapter command
da.SelectCommand() = cmd
'fill the dataset
da.Fill(ds)
'write out the data to prove that we did something!
ds.WriteXml("c:\test.xml")
'close the connection
cnn.Close()
'clear up all those objects
ds = Nothing
da = Nothing
cmd = Nothing
cnn = Nothing
End Sub
End Class
Or finish you off!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|