Click here to Skip to main content
15,922,166 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

i wrote the below code for binding and displaying the data in gridview

C#
try
        {
 //       int searchstring;
        string qry = "SELECT question_bank.question, question_bank.answer,question_bank.subject, question_bank_1.docname,question_bank_1.year FROM question_bank INNER JOIN question_bank_1 ON question_bank.qno=question_bank_1.qno where question_bank_1.question like ' %"+ TextBox1.Text +" %' ORDER BY question_bank_1.qno";
        DataSet ds = db.upDataset(qry);
        GridView1.Visible = true;
        GridView1.DataSource = ds;
        GridView1.DataBind();
        }
       catch(Exception ex)
        {
        }


there is no error in the code but at end it not showing the gridview..please tell me where i am going wrong...
Posted
Updated 26-Sep-12 22:19pm
v2
Comments
Abhinav S 27-Sep-12 4:17am    
Run the same query in SQL Management Studio and check if it returns any records.
[no name] 27-Sep-12 4:20am    
i corrected..
Malli_S 27-Sep-12 4:41am    
If so, mark the question as solved.
[no name] 27-Sep-12 4:44am    
how to mark that..???

1 solution

ds should changed to ds.Tables[0]
 
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