还问一个问题在webform窗口加入textbox控件,怎样将数据集的一个字段捆绑到textbox控件中去?好像在winform中可以。

解决方案 »

  1.   

    第一个问题
    http://www.dotnetbips.com/displayarticle.aspx?id=101
      

  2.   

    下面是我的一段代码,数据库是mssql自带的
    {string imgid =Request.QueryString["no"]; string connstr="data source=leebons;initial catalog=Northwind;integrated security=SSPI;persist security info=False;workstation id=LEEBONS;packet size=4096"; string sql="SELECT Description,Picture FROM Categories where CategoryID="+imgid; SqlConnection connection = new SqlConnection(connstr); SqlCommand command = new SqlCommand(sql, connection); connection.Open(); SqlDataReader dr = command.ExecuteReader(); if(dr.Read()) { 
                  //  FileStream fs = new FileStream("C:\\temp.jpg", FileMode.Create);
    //fs.Write((byte[]) dr["Picture"],0,((byte[]) dr["Picture"]).Length);
    //fs.Close();
    //Response.ContentType = dr["Picture"].GetType().ToString(); Response.BinaryWrite( ((byte[])dr["Picture"]) );
    }
    可是我看见怎么是乱码啊?请问这是怎么回事?
      

  3.   

    顶,我也遇到这类问题,而且下载的时候弹出的是下载aspx文件的对话框?!
      

  4.   

    Response.ContentType = ImageType;// Write data out of database into Output Stream
    Response.OutputStream.Write((byte[])Image, 0, ImageLength);
      

  5.   

    http://www.yesky.com/20030311/1656281.shtml
      

  6.   

    下面是我的一段代码,数据库是mssql自带的
    {string imgid =Request.QueryString["no"]; string connstr="data source=leebons;initial catalog=Northwind;integrated security=SSPI;persist security info=False;workstation id=LEEBONS;packet size=4096"; string sql="SELECT Description,Picture FROM Categories where CategoryID="+imgid; SqlConnection connection = new SqlConnection(connstr); SqlCommand command = new SqlCommand(sql, connection); connection.Open(); SqlDataReader dr = command.ExecuteReader(); if(dr.Read()) { 
                  //  FileStream fs = new FileStream("C:\\temp.jpg", FileMode.Create);
    //fs.Write((byte[]) dr["Picture"],0,((byte[]) dr["Picture"]).Length);
    //fs.Close();
    //Response.ContentType = dr["Picture"].GetType().ToString(); Response.BinaryWrite( ((byte[])dr["Picture"]) );
    }
    可是我看见怎么是乱码啊?请问这是怎么回事?请帮我修改这段代码!!
      

  7.   

    下面是我的一段代码,数据库是mssql自带的
    {string imgid =Request.QueryString["no"]; string connstr="data source=leebons;initial catalog=Northwind;integrated security=SSPI;persist security info=False;workstation id=LEEBONS;packet size=4096"; string sql="SELECT Description,Picture FROM Categories where CategoryID="+imgid; SqlConnection connection = new SqlConnection(connstr); SqlCommand command = new SqlCommand(sql, connection); connection.Open(); SqlDataReader dr = command.ExecuteReader(); if(dr.Read()) {                     Response.BinaryWrite( ((byte[])dr["Picture"]) );
    }
    可是我看见怎么是乱码啊?请问这是怎么回事?请帮我修改这段代码!!
      

  8.   

    你把这段代码放在哪里了,是应用程序中,还是放在ASP.NET中?
      

  9.   

    当然在ASP.NET中,这段代码写在page的load事件中。
    请帮我修正