TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abhimanyu K Vatsa
NA
40.4k
21.4m
data in GridView
Jun 11 2010 5:53 AM
Hello I want to display the retried data in GridView1. How to processed here
protected void Button1_Click(object sender, EventArgs e)
{
//data soure control that works with sql database
SqlDataSource sds = new SqlDataSource();
//get connection string from application's web.config file
sds.ConnectionString = ConfigurationManager.ConnectionStrings["myDbConnectionString1"].ToString();
//create parameters with specified name and values
sds.SelectParameters.Add("roll", TypeCode.String, this.TextBox1.Text);
//set the sql string to retrive data from the database
sds.SelectCommand = "SELECT * FROM [myTb] WHERE [roll]=@roll";
//retrive data
DataView dv = (DataView)sds.Select(DataSourceSelectArguments.Empty);
if (dv.Count == 0)
{
this.Label1.Text = "No Data Found";
return;
}
else
{
this.GridView1.DataSource =
dv.Select();
}
}
Please look at the red colored text and reply me what I have to write there to receive the data in GridView1.
Help me !
Reply
Answers (
2
)
Convert XML to Excel
Cannot insert the value NULL into column 'name'......