3
Answers

Get result from SQL by Where Condition on Image Datatype Col

Ajay Patel

Ajay Patel

10y
1.3k
1
Hello,

I have a table in SQL that has Image datatype column.

Now I pass Byte[] array in Parameter for where condition on Image Column but I didn't find any result.
here is my Code.

IN SQL :

SELECT * FROM tblnotifications where CONVERT(VarBinary, img)=( SELECT CONVERT(VarBinary, img) FROM tblnotifications where ID = 2)

This is working fine.

But in C#:

string strExist = "Select  * from tblnotifications Where CONVERT(VARBINARY,Mugshot) = @Mugshot";
dbp = new DbParameters();
dbp.SetParameter("@Mugshot", lstXCADData[j].Mugshot, SqlDbType.VarBinary, 16);
DataSet dsExist = Query.DataSet(strExist, dbp, PoolName);

This is not working.  so how can I do this.
Answers (3)