Привожу код который использую - может чего не хватает?
- Код: Выделить всё
Private sqlDa As OleDb.OleDbDataAdapter
Private sqlDT As DataTable = New DataTable
Private sqlDV As DataView = New DataView
Private sqlDS As New DataSet
Private sqlDR As DataRow
Sub GetData
SQLstr = "exec Users_Select"
SQLstr = "SELECT IdUser, NameUser, DomenNameUser, FIOUser, IsAdmin, IsSpecial FROM T_Users"
sqlDa = New OleDb.OleDbDataAdapter(SQLstr, BuildConnectionString)
sqlDa.Fill(sqlDS)
Grid.DataSource = sqlDS.Tables(0).DefaultView
End Sub
Sub AddNew
sqlDR = sqlDS.Tables(0).NewRow
sqlDR.BeginEdit()
sqlDR("NameUser") = ""
sqlDR("DomenNameUser") = ""
sqlDR("FIOUser") = "Новый пользователь"
sqlDR("IsAdmin") = 0
sqlDR("IsSpecial") = 0
sqlDR.EndEdit()
sqlDS.Tables(0).Rows.Add(sqlDR)
Dim sqlSB As OleDb.OleDbCommandBuilder
sqlSB = New OleDb.OleDbCommandBuilder(sqlDa)
sqlDa.InsertCommand = sqlSB.GetInsertCommand
sqlDa.Update(sqlDS, sqlDS.Tables(0).TableName)
sqlDS.AcceptChanges()
End Sub
Sub Edit
sqlDR.BeginEdit()
sqlDR("NameUser") = txtNameUser.Text
sqlDR("DomenNameUser") = txtDomenNameUser.Text
sqlDR("FIOUser") = txtFIO.Text
sqlDR("IsAdmin") = IIf(chckIsAdmin.Checked, 1, 0)
sqlDR("IsSpecial") = IIf(chckIsSpecial.Checked, 1, 0)
sqlDR.EndEdit()
Dim sqlSB As OleDb.OleDbCommandBuilder
sqlSB = New OleDb.OleDbCommandBuilder(sqlDa)
sqlDa.UpdateCommand = sqlSB.GetUpdateCommand
sqlDa.Update(sqlDS, sqlDS.Tables(0).TableName)
sqlDS.AcceptChanges()
End Sub
Private Sub sDelRecord()
sqlDR.Delete()
Dim sqlSB As OleDb.OleDbCommandBuilder
sqlSB = New OleDb.OleDbCommandBuilder(sqlDa)
sqlDa.DeleteCommand = sqlSB.GetDeleteCommand
sqlDa.Update(sqlDS, sqlDS.Tables(0).TableName)
sqlDS.AcceptChanges()
End Sub
За ранее спсибо за любые советы.