silverstormboy
Member
Hi, I want to insert the date into my table , but error appears when i tried to run.
Here is the code:
Is there anything wrong with the code?
It went wrong when i try to add the date (textbox4.text), but if i dont use the date and just insert the subject and message, it can run successfully.
The problem is on the date which i dont know why.
when i try to catch the error message, the message is:
SYNTAX ERROR IN INSERT INTO STATEMENT
Please help me...
Thanks in advance
Here is the code:
Code:
Private Sub CmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSave.Click
mycommand.Dispose()
mycommand.Connection = cn
mycommand.CommandText = "INSERT INTO ReminderTable(Subject,Date,Message) VALUES(@Subject,@Date,@Message) "
mycommand.Parameters.Add("@Subject", TextBox1.Text)
mycommand.Parameters.Add("@Date", CDate(TextBox4.Text))
mycommand.Parameters.Add("@Message", TextBox3.Text)
Try
cn.Open()
If cn.State = ConnectionState.Open Then
MessageBox.Show("Connection Opened Successfully")
mycommand.ExecuteNonQuery()
End If
Catch frans As System.Exception
MessageBox.Show(frans.ToString)
Me.Dispose()
End Try
cn.Close()
End Sub
It went wrong when i try to add the date (textbox4.text), but if i dont use the date and just insert the subject and message, it can run successfully.
The problem is on the date which i dont know why.
when i try to catch the error message, the message is:
SYNTAX ERROR IN INSERT INTO STATEMENT
Please help me...
Thanks in advance