Hii, in my table I have fields like id1,title,description,category,posteddate..In my gridview I wish to display title,posteddate and category. I placed a hyperlink for title field. Now when I click on title it should display the description part which I have entered before. My problem is when I bind the description part to gridview its binding all the data which is present under description but I want only the description part which is entered by that particular user..
Do I need to do anything with id1 in the query part..Pls let me know
Here is my code:
===================
SqlConnection sqlCn = new SqlConnection("User ID=sa;Initial Catalog=harini;Data Source=SYS05");
DataSet ds;
protected void Page_Load(object sender, EventArgs e)
{
ds = getdataset();
GridView1.DataSource = ds;
GridView1.DataBind();
}
public DataSet getdataset()
{
string query = ("SELECT title, category, posteddate FROM tblAdd");
SqlDataAdapter mydap = new SqlDataAdapter(query, sqlCn);
DataSet ds = new DataSet();
mydap.Fill(ds);
return ds;
}
Please check this(its urgent)
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Gaurav TomarRank #1,421 · 1.2K reputationPosted Aug 27, 2008, 9:03 PM EDT
Hi,
Yes you have to select your data (description) according to the specific ID value, So that you get specfic data against particular title.
for eg.
Change your query like this:
sting getID = //Fetch specific ID value for you title;
string query = ("SELECT title, category, posteddate FROM tblAdd where ID = getID");
Modify the above code according to your need.
Hope this will helps you!!