B
Brian Henry
i get this error "datatype mismatch" when i do the code below, it works if i
take out the date field.. this is to an access database with a date/time
column... please tlel me what im doing wrong.. thanks!
' If Not IsPostBack Then
Dim cmdPostQuestion As New OleDb.OleDbCommand("INSERT INTO hd_questionsasked
(askedBy,questionText,dateAsked) VALUES (?,?,?)")
cmdPostQuestion.Connection = dbConnection
If dbConnection.State = ConnectionState.Closed Then
dbConnection.Open()
End If
cmdPostQuestion.Parameters.Add("askedBy", OleDb.OleDbType.VarWChar).Value =
getUserName()
cmdPostQuestion.Parameters.Add("dateAsked", OleDb.OleDbType.DBDate).Value =
Now.Date
cmdPostQuestion.Parameters.Add("questionText",
OleDb.OleDbType.VarWChar).Value = Me.txtAskedQuestion.Text
cmdPostQuestion.ExecuteNonQuery()
dbConnection.Close()
' End If
Response.Redirect("/hd_questionasked.aspx")
by the way i tried oledb.oledbtype.date also and it gave me the mismatch
error still..
take out the date field.. this is to an access database with a date/time
column... please tlel me what im doing wrong.. thanks!
' If Not IsPostBack Then
Dim cmdPostQuestion As New OleDb.OleDbCommand("INSERT INTO hd_questionsasked
(askedBy,questionText,dateAsked) VALUES (?,?,?)")
cmdPostQuestion.Connection = dbConnection
If dbConnection.State = ConnectionState.Closed Then
dbConnection.Open()
End If
cmdPostQuestion.Parameters.Add("askedBy", OleDb.OleDbType.VarWChar).Value =
getUserName()
cmdPostQuestion.Parameters.Add("dateAsked", OleDb.OleDbType.DBDate).Value =
Now.Date
cmdPostQuestion.Parameters.Add("questionText",
OleDb.OleDbType.VarWChar).Value = Me.txtAskedQuestion.Text
cmdPostQuestion.ExecuteNonQuery()
dbConnection.Close()
' End If
Response.Redirect("/hd_questionasked.aspx")
by the way i tried oledb.oledbtype.date also and it gave me the mismatch
error still..