type is not defined for OleDbConnection, OleDbDataAdapter, OleDbCommand

asn1981

Active member
Joined
Mar 15, 2005
Messages
38
Programming Experience
Beginner
I am trying to create an access connection with the code below.
however, for OleDbConnection, OleDbDataAdapter, oledbcommand i keep getting "type ..(one of the three above).. is not defined".

my form is currently empty with nothing on it, i dont think this can be the cause.
my code can be seen below

Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & servermappath("C:\Documents and Settings\Owner\My Documents\Visual Studio Projects\Calculator\master_db.mdb"))

Dim sql As String = "Select * from order_details"

Dim dta As OleDbDataAdapter
dta = New OleDbDataAdapter

Dim cmd As New OleDbCommand
cmd = New OleDbCommand(sql, con)

dta.SelectCommand = cmd

Dim dst As New DataSet

Try
dta.Fill(dst, "order_details")
Catch ex As Exception
MsgBox(ex, ToString)
End Try
 
VB.NET:
Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source'C:\Documents and Settings\Owner\My Documents\Visual Studio Projects\Calculator\master_db.mdb'")

Dim sql As String = "Select * from order_details"

Dim dta As New OleDbDataAdapter(sql, con)

Dim dst As New DataSet

Try
con.open
dta.Fill(dst, "order_details")
con.close
Catch ex As Exception
MsgBox(ex, ToString)
End Try
 
hi TPM thanks for your quick reply..
however OleDbConnection and OleDbDataAdapter are still getting underlined, with the mouseover saying ... "Type 'OleDbConnection' is not defined"
I am sorry if there is a simple answer to this but im new to vb.net
thanks in advance


TPM said:
VB.NET:
Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source'C:\Documents and Settings\Owner\My Documents\Visual Studio Projects\Calculator\master_db.mdb'")

Dim sql As String = "Select * from order_details"

Dim dta As New OleDbDataAdapter(sql, con)

Dim dst As New DataSet

Try
con.open
dta.Fill(dst, "order_details")
con.close
Catch ex As Exception
MsgBox(ex, ToString)
End Try
 
Back
Top