T
Treaser
Guest
i keep getting error trying to add the date field to access database through my web form, all works until I add the date field.
I tried doing it different ways nothing works.
Dim DATEtmp As TextBox = DirectCast(FormView1.FindControl("DATETextBox"), TextBox)
Dim Drafter As TextBox = DirectCast(FormView1.FindControl("DrafterTextBox"), TextBox)
Dim Get_Constring As String = cn.ConnectionString
'get connection string declared in the Module1.vb and assing it to conn variable
Dim test As Date
'Dim dateFrom = DateTime.ParseExact(DATEtmp.Text), "yyyy-MM-dd")
Dim dateFrom = Date.Parse(DATEtmp.Text)
test = dateFrom
test = FormatDateTime(test, DateFormat.ShortDate)
MsgBox(test)
conn = New OleDbConnection(Get_Constring)
cmd.Connection = conn
cmd.CommandText = "UPDATE SketchDWG SET JOBno ='" & JOBno.Text & "',Type ='" & Type.Text & "',TITLE = '" & TITLE.Text & "',DATE=#" & test.ToShortDateString & "#, Drafter='" & Drafter.Text & "' WHERE DWGno = '" & key.Value.ToString() & "'"
conn.Open()
cmd.ExecuteNonQuery()
Continue reading...
I tried doing it different ways nothing works.
Dim DATEtmp As TextBox = DirectCast(FormView1.FindControl("DATETextBox"), TextBox)
Dim Drafter As TextBox = DirectCast(FormView1.FindControl("DrafterTextBox"), TextBox)
Dim Get_Constring As String = cn.ConnectionString
'get connection string declared in the Module1.vb and assing it to conn variable
Dim test As Date
'Dim dateFrom = DateTime.ParseExact(DATEtmp.Text), "yyyy-MM-dd")
Dim dateFrom = Date.Parse(DATEtmp.Text)
test = dateFrom
test = FormatDateTime(test, DateFormat.ShortDate)
MsgBox(test)
conn = New OleDbConnection(Get_Constring)
cmd.Connection = conn
cmd.CommandText = "UPDATE SketchDWG SET JOBno ='" & JOBno.Text & "',Type ='" & Type.Text & "',TITLE = '" & TITLE.Text & "',DATE=#" & test.ToShortDateString & "#, Drafter='" & Drafter.Text & "' WHERE DWGno = '" & key.Value.ToString() & "'"
conn.Open()
cmd.ExecuteNonQuery()
Continue reading...