Создаю программно адаптер:
- Код: Выделить всё
Public Sub Create_OleDbDataAdapter1()
Dim mySelectText As String = "SELECT * FROM Access ORDER by Login"
Dim OleDBDataAdapter1 As New OleDb.OleDbDataAdapter(mySelectText, MainConnection)
OleDBDataAdapter1.MissingSchemaAction = MissingSchemaAction.AddWithKey
OleDBDataAdapter1.InsertCommand = New OleDb.OleDbCommand("INSERT INTO Access([Group], Login, Pass) VALUES (?, ?, ?)", MainConnection)
OleDBDataAdapter1.UpdateCommand = New OleDb.OleDbCommand("UPDATE Access SET [Group] = ?, Login = ?, Pass = ? WHERE (ID = ?) AND ([Group] = " & _
"? OR ? IS NULL AND [Group] IS NULL) AND (Login = ? OR ? IS NULL AND Login IS NUL" & _
"L) AND (Pass = ? OR ? IS NULL AND Pass IS NULL)", MainConnection) 'nwindConn)
OleDBDataAdapter1.DeleteCommand = New OleDb.OleDbCommand("DELETE FROM Access WHERE (ID = ?) AND ([Group] = ? OR ? IS NULL AND [Group] IS NU" & _
"LL) AND (Login = ? OR ? IS NULL AND Login IS NULL) AND (Pass = ? OR ? IS NULL AN" & _
"D Pass IS NULL)", MainConnection)
End Sub
Но никак не могу заполнить DataSet. Явно туплю где-то..вот такими способами пытаюсь это сделать (MainDataSet уже определен и создан как объект):
- Код: Выделить всё
Dim dt As New DataTable("Access")
MainDataSet.Tables.Add(dt)
OleDBDataAdapter1.Fill(dt, "Access")
или так
- Код: Выделить всё
OleDBDataAdapter1.Fill(MainDataSet)
но на строке Fill отладчик выдает ошибку