System.Data.OleDb.OleDbException: standard expression data type mismatch

2010-08-19  来源:本站原创  分类:DotNet  人气:159 

When you use the numeric type of variable, use @ ID this error occurs because the conversion into ID = '1 '
Access database is really good trouble.

I remember this problem occurs when new to issue. Results again they encountered this problem today and spent hours to find N the problem is (not yet come up with solutions)

In Access, is unable to use stored procedures, but you can use a text command, such as
update news set title = @ title, types = @ types, context = @ context where @ id ID field type for the automatic increase in sentence statement on the sql there is no problem, but there is an obvious in access Error: Standard expression Data type does not match (another result is that Bukuaigengxin which Jilu) Erzao Cheng Yuan Yin this issue of the id of the field types on the Zaiyu, in the access where @ id if id Lei Xing Wei numbers, Name can not exist''(''Here in the sql is used to specify a field value, such as the 'aaa'), and above the final text of the command execution result is update news set title = 'title', types = 'type' , context = 'content' where, do not know what this error operator error: (The correct statement should be to update news set title = 'title', types = 'type', context = 'content' where, it happens delete statement The above mentioned error does not occur, such as: delete from news where @ id
Found in the database with the access code spent the time far beyond the time with the sql code to write, and often inexplicable error with access, more is likely to have illegal characters if you do not use a text command will run error, miss sql,

I also encountered this issue, also could not find any reason for a start, read the article before understand, huh, huh. . . Thank you. . . But do not know on how to solve, and I have a method, that is: sql = "update news set title = @ title where id =" here is not first, followed by: id = @ id, but another opening line: sql = sql + id where the id is @ id .... so the above can be solved