Click here to Skip to main content
15,614,685 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I make connection with SQL database with ASP.Net page. How we show our data in gridview. Give me complete code for sqlconnection. Please help.
Posted
Updated 5-Jul-12 0:37am
v2
Comments
AshishChaudha 8-Jul-12 4:01am    
and??? you want us to work for you??? bittu..try something by yourself and wherever you get stuck then ask for help..its a bad habbit that you ask for a complete code..all are here to help, if there is any problem..try and do your best..hope you understands..wish you luck..

 
Share this answer
 
v2
Just Use Below Code:
C#
con2 = new SqlConnection();
con2.ConnectionString = @"Your connection String";
con2.Open();


 string name = "select Field from tablename";
 SqlDataAdapter name_ad = new SqlDataAdapter(name, con2);
 DataSet name_ds = new DataSet();
 name_ad.Fill(name_ds);

 Gridview1.Datasource=name_ds;
 Gridview1.Databind();

Con2.close();


This will Help You, If not please Post it.
 
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