gridview显示图像并记录 [英] gridview display image and record

查看:65
本文介绍了gridview显示图像并记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace photoshops
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        SqlConnection conn = new SqlConnection();
        protected void Page_Load(object sender, EventArgs e)
        {
            conn.ConnectionString
              = @"Data Source=DEVI\SQLEXPRESS; Initial Catalog =cat; Integrated Security=SSPI";
            Load_GridData(); // call method below
        }
        void Load_GridData()
        {
            conn.Open(); // open the connection 
            SqlDataAdapter Sqa = new SqlDataAdapter("select * from tblphotosettings", conn);
            DataSet ds = new DataSet();
            Sqa.Fill(ds);  // fill the dataset 
            GridView1.DataSource = ds.Tables[0]; // give data to GridView
            conn.Close();
        }
    }
}

我已经在客户帐单号中输入了一个文本框,然后单击在gridview中显示图像客户记录的按钮....如何更改我的代码..因为我是初学者...代码

i have enter a textbox in customer bill number and then click the button display image customer record in a gridview.... How to change in my code.. because i am begineer... can you post the code

推荐答案

检查页面定义:在GridView1定义中的某个位置具有
Check your page definition: somewhere in your definition of GridView1 you have
DataSourceID="String"

要么删除它,要么从您的Page_load方法中删除Load_GridData调用.

Either remove it, or remove the Load_GridData call from you Page_load method.


从GridView1定义中删除DataSourceID属性
Remove DataSourceID attribute from GridView1 definition


This discussion[^] should help you out.


这篇关于gridview显示图像并记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆