data adapter

admin

Administrator
Staff member
hello can somebody tell me why is this code contant error. i am new in data adapter and dataset.

Dim strConnectionString As String
strConnectionString = "Driver={MySQL};SERVER=localhost;DATABASE=tesing;"
Dim pConn As New OdbcConnection(strConnectionString)
Dim pInsertQuery As String = "SELECT * FROM name"
Dim adapter As New OdbcDataAdapter(pInsertQuery, pConn)
Dim titleDS As DataSet = New DataSet
adapter.Fill(titleDS,"name")hi, try this and see if it works (sorry mixing vb and c# code, but i'm sure u'll figure that out heh)

Dim strConnectionString As String
strConnectionString = "Driver={MySQL};SERVER=localhost;DATABASE=tesing;"
Dim pConn As New OdbcConnection(strConnectionString)
Dim pInsertQuery As String = "SELECT * FROM name"
Dim cmd As New OleDbCommand(pInsertQuery, pConn)
Dim adapter As New OdbcDataAdapter(cmd)
Dim titleDS As DataSet = New DataSet

try{
pConn.Open();
adapter.Fill(titleDS,"name")
}
catch (Exception err)
{
return;
}
finally{
pConn.close();
}
 
Back
Top