首页 > 开发 > 综合 > 正文

在数据库中存储和显示图象(存储一)

2024-07-21 02:22:50
字体:
来源:转载
供稿:网友
using system;using system.data.sqlclient;using system.data.sqltypes;using system.io;string imagefilelocation=“d:/images/”;string imagefileprefix=“cereal“;int numberimagefiles=7;string imagefiletype=“.gif“;int maximagesize=10000;sqlconnection imageconnection=null;sqlcommand imagecommand=null;]//几个要用到的方法;void openconnection() { //create sqlconnection object imageconnection=new sqlconnection(configurationsettings.appsettings[“wind“]); //open connection imageconnection.open(); }void closeconnection() { //close the connection imageconnection.close(); }void createcommand(){imagecommand=new sqlcommand();imagecommand.connection=imageconnection;}void executecommand(string commandtext){int commandresult;imagecommand.commandtext=commandtext;commandresult=imagecommand.executenonquery();}void createimagetable(){executecommand(“if exists{“+“select table_name“+“from infoemation_schema.tables“+“where table_name='imagetable'“+“) drop table imagetable“ );executecommand(“create table imagetable(“+“imagefile nvarchar(20),“+“imagedata image“+ “)“ );}
  • 网站运营seo文章大全
  • 提供全面的站长运营经验及seo技术!
  • 发表评论 共有条评论
    用户名: 密码:
    验证码: 匿名发表