我有一个图片应用程序,可以将一些信息添加到 sql 数据库中。我将图片保存varbinary
在 sql 表中。我想检查之前是否添加了图片。我的代码如下:
byte[] img = File.ReadAllBytes(item);
//that converts the file to bytearray
string str = ByteString(img);
//ByteString is a method that converts bytearray to string (It works)
DataRow[] satirlar = das.Tables[0].Select("PicBinary=" + str);
//sql table keeps picture as varbinary in PicBinary Column
if (satirlar[0]!=null)
{
//codes
continue;
}
但是我在我的 .. 上遇到了一个异常,例如 ("column (//something unreadable) not found") 。有das.Tables[0].Select command
什么建议吗?