Pages

Tuesday, 10 April 2012

How to get data from sql server in asp.net c sharp

Add following namespace  in your cs page
using System.Data.SqlClient;


 string connstring = "Your Connection String Here";
 SqlConnection cn = new SqlConnection(connstring);
 cn.Open()
SqlCommand cmd=new SqlCommand(Youe Query Here, cn);
cmd.Execute();
cn.Close();

1 comments:

Unknown said...

Oh my goodness! You're so right! I was searching for this problem quite a long time, but thank you I found my solution. Now I can get my data from SQL server in asp. Thank again for sharing.

My signature: Podiatry Websites Design Company in the USA.

Post a Comment