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 GridView1.DataBind(); conn.Close(); } protected void Button1_Click(object sender, EventArgs e) { string strText = TextBox1.Text; SqlDataAdapter Sqa = new SqlDataAdapter("select * from tblphotosettings where BillNo= " + strText + "", conn); } } }
GridView1.DataSource = ds.Tables[0]; GridView1.Databind();
GridView1.DataBind();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)