View Single Post
  #1 (permalink)  
Old February 25th, 2006, 11:49 AM
lwebzem lwebzem is offline
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Updating the record in the database

Can you please help me.
Here is my code, it's not giving any error but it does not update the field in the database.

Dim strCnx As String = AccessCnx()
Dim strSQL As String = "SELECT * FROM Schedule"
Dim cnx As OleDbConnection = New OleDbConnection(strCnx)
cnx.Open()

Dim ds As Dataset = New DataSet
Dim sda as OleDbDataAdapter
sda= New OleDbDataAdapter(strSQL, cnx)
sda.Fill(ds, "Schedule")
Dim datarow1 As DataRow
Dim scb as OledbCommandBuilder = New OleDbCommandBuilder(sda)
sda.UpdateCommand = scb.GetUpdateCommand()

 For each datarow1 in ds.Tables("Schedule").Rows
  LL.Text=LL.Text & "<br>--" & datarow1("mo_ye") ' this line works OK
    datarow1.BeginEdit()
     datarow1("mo_ye")="33333" '??this line does not update the value
    datarow1.EndEdit()
  Next

 ds.AcceptChanges()
 sda.Update(ds, "Schedule")
 cnx.Close

Many thanks in advance.