Create some text boxes with name in web form
Example:
Now drag a grid view in web form and click the edit column property show in
figure and add the item inside the grid view .You can also change it format by
using property Auto Format.
Now choose the data source and click on ok button.
Now click on New Connection and then click on
Choose either Window or server authentication, server name and attach the
database. Click on ok button
Now Click next
Further Click next
Click next and test Query and click finish
Now use the Defalut.aspx.cs page and add the following code
using System;
using System.Collections.Generic;
using
System.Linq;
using System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using System.Data.SqlClient;
public
partial class
_Default : System.Web.UI.Page
{
SqlConnection con;
SqlCommand
cmd
string str;
SqlDataAdapter
ad;
protected
void Page_Load(object sender,
EventArgs e)
{
con = new SqlConnection
("Data Source =server name;Initial
Catalog=Database Name";User ID= User;Password = your
PasswordRecovery");
con.Open();
Response.Write("connect");
}
protected
void Button1_Click(object
sender, EventArgs e)
{
str = "select * from empinfo where name ='"+TextBox1.Text+"'
,address = '"+TextBox2.Text+"',email_id
='"+TextBox3.Text+"'";
ad =new SqlDataAdapter
(str,con);
GridView1.DataSource =ds.tables [empinfo].defaultview;
GridView1.DataMember ="empinfo";
GridView1 .DataBind ();
}