problem with updating into database.
-
aspx.vb file
Public Class Default1 Inherits System.Web.UI.Page Dim inc As Integer Dim txtEventDate As Date Dim txtEventTrigger As Date Dim objConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source= " & Server.MapPath("~/App_Data/db1.mdb")) Public Sub LoadData() Dim da As New OleDbDataAdapter("SELECT * FROM checklist_Items", objConn) Dim ds As DataSet = New DataSet() da.Fill(ds, "checklist_Items") MyDataList.DataSource = ds.Tables("checklist_Items").DefaultView MyDataList.DataBind() End Sub Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then LoadData() End If End Sub Sub Update_dc(ByVal ID) '---updates the database--- Dim sql As String = "UPDATE checklist_Items SET date_Completed=#" + txtEventDate + "# WHERE ID=" + ID Dim comm As New OleDbCommand(sql, objConn) objConn.Open() comm.ExecuteNonQuery() objConn.Close() MyDataList.EditItemIndex = -1 LoadData() End Sub Sub Update_dt(ByVal ID) '---updates the database--- Dim sql As String = "UPDATE checklist_Items SET date_Trigger=#" + txtEventTrigger + "# WHERE ID=" + ID Dim comm As New OleDbCommand(sql, objConn) objConn.Open() comm.ExecuteNonQuery() objConn.Close() MyDataList.EditItemIndex = -1 LoadData() End Sub Sub MyDataList_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles MyDataList.UpdateCommand Dim tbox As TextBox Dim ID0 As String Dim sday As DateTime '---retrieves the key for the row--- ID0 = MyDataList.DataKeys(e.Item.ItemIndex) '---find the textbox control containing the dateCompleted tbox = CType(e.Item.FindControl("txtEventDate"), TextBox) txtEventDate = tbox.Text sday = txtEventDate If (ID0 = 5) Then Update_dc(ID0) MsgBox("eventdate " + txtEventDate) '---retrieves from another database--- Dim con = "Provider=Microsoft.Jet.OLEDB.4.0;" & _