If the database is an image type, when the INSERT statement is executed, if the inserted value is Dbnull.value prompt: Operand type conflict: nvarchar is incompatible with image;
This problem occurs because there is no reason to specify DbType. In most cases, you do not need to specify the data type of the parameter (DbType or SqlDbType) when using SqlParameter, ADO. NET will automatically determine the type of data based on the type of value, even if it cannot be determined by ADO, SQL Server database servers can do most of the judgment (of course, some loss of performance).
But for the image type in this program is not so fortunate, if you do not specify DBTYPE, and the exact data is null/dbnull, the data type identified as nvarchar, the above error occurred. So just specify DbType or SqlDbType.
New SqlParameter ("@Photo", Sqlhelp.todbnull (employee. Photo)
New SqlParameter ("@Photo", Sqldbtype.image) {value=sqlhelp.todbnull (employee. Photo)}
So when using the above SqlParameter , will definitely error, with the following SqlParameter, because we specify the SqlDbType type is image, this error will not appear.
This article refers to the URL: http://bbs.itcast.cn/thread-11263-1-1.html
About the "count type conflicts: nvarchar and image incompatible" issue