Click here to Skip to main content
15,911,132 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string strText = TextBox1.Text;
            SqlDataAdapter Sqa = new SqlDataAdapter("select * from tblphotosettings where BillNo= " + strText + "", conn);
        }
    }
}
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
Posted
Updated 15-Apr-11 1:21am
v2

1) Add a button to your code
2) Add a textbox to your code (for the bill number)
3) On the button's clcik event handler, write some code to insert the bill no into your database.
 
Share this answer
 
Comments
kannan 2 15-Apr-11 6:51am    
i am begineer can you modify the code and can you post the code
use button click event
in that u can write like
C++
string strText=textbox.text;

SqlDataAdapter Sqa = new SqlDataAdapter("select * from tblphotosettings where YourColumnName= "+strText+"", conn);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900