469,320 Members | 2,121 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,320 developers. It's quick & easy.

visual basic data type mismatch in criteria expression??

i cant find the problem can anyone help me pls???


If userNameTextBox.Text <> "" Then
Dim sqlQRY As String = "INSERT INTO SalesOrder Values ('" & salesNoTextBox.Text & "', '" & orderDateTextBox.Text & "', '" & userNameTextBox.Text & "', '" & productCodeTextBox.Text & "', '" & quantityTextBox.Text & "')"
Try
conn.Open()
Dim cmd As OleDbCommand = New OleDbCommand(sqlQRY, conn)
cmd.ExecuteNonQuery()
Catch ex As OleDbException
MsgBox("Error: " & ex.ToString & vbCrLf)
Finally
conn.Close()
End Try
saveButton.Enabled = False
Else
MsgBox("Please select customer")
userNameTextBox.Focus()
End If
Dec 23 '11 #1
7 4302
Rabbit
12,516 Expert Mod 8TB
It's probably because you're trying to insert a string into that date field. But I have no idea because you haven't told us what the data types are for your fields.
Dec 23 '11 #2
i am doing a sales order form. pls help!!!
Dec 23 '11 #3
Rabbit
12,516 Expert Mod 8TB
I did help. I helped all I could given the information that was provided.
Dec 23 '11 #4
so may i know which code i have to change?
Dec 23 '11 #5
Rabbit
12,516 Expert Mod 8TB
I don't know what you have to change. I can only guess at the error because I don't have everything I need to know to pinpoint the error.
Dec 23 '11 #6
Try this and let me know if it works.....

"INSERT INTO SalesOrder Values ('" & salesNoTextBox.Text & "', '" & Convert.ToDateTime(orderDateTextBox.Text) & "', '" & userNameTextBox.Text & "', '" & productCodeTextBox.Text & "', '" & quantityTextBox.Text & "')"
Dec 24 '11 #7
Killer42
8,435 Expert 8TB
I wonder whether putting hashes (#) around the date value might help.

But yeah, what we really need is more info about the circumstances.
Dec 24 '11 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by N J | last post: by
1 post views Thread by amitbadgi | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.