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;
}
Loading
Gaurav TomarPosted Aug 28, 2008, 1:03 AM
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!!