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


Top 5 Contributors of the Month
ASPEvil
Ashutosh Jha
Jean Paul
satyapriyanayak
SP

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

Display Data in Gridview

Posted By: siri.k     Posted Date: July 18, 2011    Points:5   Category :VB.Net
hi can any one tell me ......

i have an insert button after click of that button i have to display all the data available in my database table which i had created in to the gridview plz give me detail code

if i have a table sam then how can i show all the data avail in sam into the grid view plz

thanks in advance
siri

Responses
Author: Narayanan             
Posted Date: July 18, 2011     Points: 20   

hi,
Please ask a question clearly...
Thanks


Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
Author: Sasi Prabhu             
Posted Date: July 18, 2011     Points: 20   

try

To insert the values into DataBase Table "sam" Use

SqlConnection con=new SqlConnection(<Provider>);
con.Open();
SqlCommand cmd=new SqlCommand("insert into sam values('"+txt_textbox.Text+"' ,....)",con);
cmd.ExecuteNonQuery();
con.Close();


Then Bind the Values into Gridview.




Thanks & Regards,
Sasi Prabhu.
Author: Sasi Prabhu             
Posted Date: July 18, 2011     Points: 20   

To Bind the Data into Gridview :


SqlConnection con=new SqlConnection(<Provider>);
con.Open();
SqlCommand cmd=new SqlCommand("select * from sam",con);
SqlDataReader dr=cmd.ExecuteReader();
DataTable dt=new DataTable();
dt.Load(dr);
GridView1.DataSourece=dt;
GridView1.DataBind();
con.Close();





Thanks & Regards,
Sasi Prabhu.
Author: Ravi Ranjan Kumar             
Posted Date: July 19, 2011     Points: 20   

hey! Sasi you should focus on OP question Category. he need solution based VB.net language and your solution using C#.

Thanks & Regards
Ravi Ranjan Kumar
http://raviranjankr.wordpress.com
Author: Ravi Ranjan Kumar             
Posted Date: July 19, 2011     Points: 20   

Hey! You can use given link to learn how to bind gridview to database
http://www.vbnettutorial.net/?Id=125&Desc=VB.Net-DataGridView
try it and if you have problem then please revert back with specific question.

Thanks & Regards
Ravi Ranjan Kumar
http://raviranjankr.wordpress.com
Author: Gowthammanju             
Posted Date: July 29, 2011     Points: 20   

use coding as


Dim con As New SqlClient.SqlConnection("connectionstring")

Dim da As New SqlClient.SqlDataAdapter("select * from sam", con)

da.Fill(ds)
Me.DataGridView1.DataSource = ds.Tables(0)


Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Gowthammanju             
Posted Date: July 29, 2011     Points: 20   

try these as


http://www.dotnetspark.com/kb/Content.aspx?id=4503

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true


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
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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