As i am working on a project in which i required to connect my database but i am unable to find connection class..
Plzz help me out as soon as possible!!!!!
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pravin MorePosted Nov 4, 2011, 12:35 AM
there are many way for connect to database and perform oprations....
here i am giving sample ,hope it will help you......
SqlConnection con = dbcon.getcon("Data Source=yourSqlSERVERName;Initial Catalog=Databasename;Persist Security Info=True;User ID=Your ID;Password=xxxxx");
con.Open();
SqlCommand spcmd = new SqlCommand("Select * from Tablename", con);
SqlDataReader dr = spcmd.ExecuteReader();
while(dr.Read())
{
//Your Processing
}
Thanks,
Pravin.