mysql存储图片的问题 - .NET技术 / C#
把图片存入到mysql中:
DateTime dt = (DateTime)para[0];
string plateNo = (string)para[1];
byte[] photo = (byte[])para[2];
string sqlString = "insert into table1(Time,PlateNo,PlateImg) VALUES(?dt,?plateNo,?photo)";
MySQLCommand dbCommand = new MySQLCommand();
dbCommand.Connection = dbConnection;
dbCommand.CommandText = sqlString;
dbCommand.CommandType = System.Data.CommandType.Text;
MySQLParameter mp1 = new MySQLParameter("?dt", System.Data.DbType.DateTime);
mp1.Value = dt;
dbCommand.Parameters.Add(mp1);
MySQLParameter mp2 = new MySQLParameter("?plateNo", System.Data.DbType.String);
mp2.Value = plateNo;
dbCommand.Parameters.Add(mp2);
MySQLParameter mp3 = new MySQLParameter("?photo", System.Data.DbType.Binary);
mp3.Value = photo;
dbCommand.Parameters.Add(mp3);
MessageBox.Show("photo length:" + ((byte[])(mp3.Value)).Length.ToString());
dbCommand.ExecuteNonQuery();
把图片读出来:
byt
相关问答:
21cn的邮箱,在outlook配置后可以正常收发邮件,可是我写在C#中就不行,换成其它邮箱,163很早注册的。可以发送。查了很久,没有找到原因,请高手帮忙解答。。。小弟,谢了。。代码如下:
private void SendMail ......
思路:要用c#生成一个播放机的播放列表的xml,例如:
<daty datys='2010-04-05' datye='2010-05-01' > //这是播放的日期段
<time times='01:12:00' timee='02:30:00'> ......
公司开发一个触摸屏程序,我负责的一块,实现这样一个功能,当鼠标点击窗口中图片(一张图分成几部分)的其中一部分时,将这部分图片截取出来,弹出新的窗口,将截取出的图片显示出来。我使用Rectange类控制了返回, ......
Java code:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was51093 seconds ago.The last packet sent successfully to the server was 5 ......