Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi there,


there is total 10 field in table(access). whenever i leave textbox blank it gives error ("datatype mismatch in criteria expression").

how can i solve it.
Posted
Comments
Siva Hyderabad 9-Feb-14 23:22pm    
which textbox.,which datatype you take for that?
[no name] 10-Feb-14 0:05am    
for mobile number (textbox). number datatypes
Karen Mitchelle 10-Feb-14 0:23am    
the error message already said it. Could you give us enough information for this. Textboxes receive and store values as string. So if in your table, it is declared as int, and you store it directly, a datatype mismatch will occur.
[no name] 10-Feb-14 0:30am    
so what is the solution....
Karen Mitchelle 10-Feb-14 0:36am    
Can you please give me at least the scenario of what your problem looks like? Thanks..

Your question does not provide enough information to answer the question completely.

However, this error occurs when you are inserting the wrong data type in a column for e.g. int in a datetime field etc.
 
Share this answer
 
Comments
[no name] 9-Feb-14 23:55pm    
when i leave number filed leave then it gives error.
for mobile number ,You should given like..

In SQL you need to create the column as "varchar" datatype

To access that value in C# take "string" variable
 
Share this answer
 
v2
Hai

Try to check no of fields u have to insert,may be u have 10 fields but u try to insert only 9 values so it gives error,check insert query,paste ur insert query here ,then find error easily.

And if u insert integer give single qutos ,if it is string give double quots.


Why u leave empty text box ? u try to insert empty values so it gives error.so change the column in a access table like select column and give "Required" as No in each column,may be for number column cant give empty value,so make it as mandatory field.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900