如何操作sqlserver 数据库的image字段 -|walrus 发表于 2006-9-27 12:37:00 | |
string modelFileName = curTempPath+"test.model"; sqlConnection con = new sqlConnection("server=192.9.200.134;database=test;user=sa;password=999"); " //读取 if(con.State==0) con.open(); sqlCommand cm=new sqlCommand(); cm.Connection=con; cm.CommandType=CommandType.Text; cm.CommandText="select * from model where id=1"; sqlDataReader dr=null; dr=cm.ExecuteReader(); byte[] File=null; if(dr.Read()) { File=(byte[])dr["fieldname"]; } string fileName="d://www.model"; FileInfo fi=new System.IO.FileInfo(fileName); FileStream fs=fi.OpenWrite(); fs.Write(File,File.Length); fs.Close(); |
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。