Link to home
Start Free TrialLog in
Avatar of FYPJ
FYPJ

asked on

Date mismatch when using number type in Access

Hi,

I used to use String type for all my variable types in my Access DB even for variables with number types like IDs.

Due to some constraints i have to use Number types for my IDs now.

Here is an example of my SQL which has a data mismatch error.

Dim item As Integer
item = Request.QueryString("topicID")

Cmd = New OleDb.OleDbCommand("Select topicID ForumPosts where topicID ='" + item + "'", Conn)

I have also tried enclosing item in  only double quotes "+item+" or single quotes '+item+', and still the same error occurs.

It produces a data mismatch error. So what is the problem lying here?
Avatar of burakiewicz
burakiewicz
Flag of United States of America image

for integers in access you don't use any quotes ex
Cmd = New OleDb.OleDbCommand("Select topicID ForumPosts where topicID =" + item + ", Conn)
ASKER CERTIFIED SOLUTION
Avatar of Arthur_Wood
Arthur_Wood
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of FYPJ
FYPJ

ASKER

OK thanks for both the answers.