.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Kaviya Balasubramanian
Sgraph Infotech
Imran Ghani

Home >> Forum >> VB.Net >> Post New QuestionBookmark and Share Subscribe to Forum


Posted By: srini     Posted Date: November 17, 2010    Points:2   Category :VB.Net
Hello Everyone!

I am developing one application using vb.net and SQL server 2005. I am having Qusetion and answer column in database. I just wanted to retrieve all the data's(for ex:table contains 10 questions and 10 answers)from database and show it into vb.net form having Labels control.

Help me!

Author: Asha.MP             
Posted Date: November 17, 2010     Points: 5   


You need to display the count right?? you can use select count(*) from table query to display the data count.

Thanks and Regards,
Author: srini             
Posted Date: November 17, 2010     Points: 5   


I dont want to count the rows in a table. I wanted to display all the rows and columns data in a table,while loading the form itself.

Help me!


Author: Dhivakaran             
Posted Date: November 22, 2010     Points: 5   

For that you can go gridview.

<asp:GridView ID="grdData" BorderColor="Black" runat="server" AutoGenerateColumns="False" >
<asp:TemplateField HeaderText="Qustion">
<ItemStyle Width="60px"/>
<asp:Label ID="lblQns" runat="server" Text='<%#Eval("qns")%>'></asp:Label>
<asp:TemplateField HeaderText="Answer">
<ItemStyle Width="60px"/>
<asp:Label ID="lblAns" runat="server" Text='<%#Eval("ans ")%>'></asp:Label>

then in code behind

private void bindgrid()
DataSet dt = new DataSet();
string sql ="Select qns,ans from tblname";
SqlConnection sqlcon = new SqlConnection("connectionstring");
SqlCommand cmd=new SqlCommand();
SqlDataAdapter da =new SqlDataAdapter(cmd,sqlcon);
if (dt.Rows.Count > 0)
grdData.DataSource = dt;

Dhivakaran T

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend