472,133 Members | 1,122 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,133 software developers and data experts.

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 4487
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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.