从数据库将图片显示到picturebox上。有一个异常,小弟真的没招了。高手进!在线等!!
这是小弟的图片插入程序:
SqlCommand Command = new SqlCommand(@ "INSERT INTO TaskScan (Task_serialNumber,picture1,picture2,picture3,picture4,picture5,
picture6,picture7,picture8,picture9,picture10)
VALUES (@Task_serialNumber,@picture1,@picture2,@picture3,@picture4,@picture5,
@picture6,@picture7,@picture8,@picture9,@picture10) ", connection, tran);
Command.Parameters.Add(new SqlParameter( "@Task_serialNumber ", SqlDbType.VarChar, 50));
Command.Parameters.Add(new SqlParameter( "@picture1 ", SqlDbType.Image,16));
Command.Parameters.Add(new SqlParameter( "@picture2 ", SqlDbType.Image, 16));
Command.Parameters.Add(new SqlParameter( "@picture3 ", SqlDbType.Image, 16));
Command.Parameters.Add(new SqlParameter( "@picture4 ", SqlDbType.Image, 16));
Command.Parameters.Add(new SqlParameter( "@picture5 ", SqlDbType.Image, 16));
Command.Parameters.Add(new SqlParameter( "@picture6 ", SqlDbType.Image, 16));
Command.Parameters.Add(new SqlParameter( "@picture7 ", SqlDbType.Image, 16));
Command.Parameters.Add(new SqlParameter( "@picture8 ", SqlDbType.Image, 16));
Command.Parameters.Add(new SqlParameter( "@picture9 ", SqlDbType.Image, 16));
Command.Parameters.Add(new SqlParameter( "@picture10 ", SqlDbType.Image, 16));
bool bSucceed = false;
try
{
Command.Parameters[ "@Task_serialNumber "].Value = GetValue(data.Task_serialNumber);
Command.Parameters[ "@picture1 "].Value = GetValue(data.picture1);
Command.Parameter