Hi,
I have problem updating the changes in the dataset to the database. I am using an Access database and following is the code used for adding a new row. Please help
Private Sub ClientAdd_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
conString = "User ID=;Password=;Data Source=C:\VBProject\SasloBilling\SASLO-Billing.mdb;Provider=Microsoft.Jet.OLEDB.4.0;Persi st Security Info=False" ';Initial Catalog=ClientIndex"
sqlString = "Select * from ClientIndex"
dsClient = New DataSet
daClient = New OleDb.OleDbDataAdapter(sqlString, conString)
daClient.Fill(dsClient, "ClientIndex")
Catch exLoad As Exception
MsgBox(exLoad.Message)
End Try
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Try
rowClient = dsClient.Tables("ClientIndex").NewRow
rowClient("FileNo") = txtFileNo.Text
rowClient("MainFile") = txtFileNo.Text
rowClient("PCFile") = "No PC"
dsClient.Tables("ClientIndex").Rows.Add(rowClient)
'dsClient.AcceptChanges()
daClient.Update(dsClient,"ClientIndex"))
MsgBox("Record Added Sucessfully")
Catch exSave As Exception
MsgBox(exSave.Message)
End Try
End Sub