how to connect to a microsoft sql database?

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2008
Posts: 6
Reputation: mostafanageeb has a little shameless behaviour in the past 
Solved Threads: 0
mostafanageeb mostafanageeb is offline Offline
Newbie Poster

how to connect to a microsoft sql database?

 
0
  #1
Apr 30th, 2009
Please I am now making a project using C# and I want to connect to a database how to do this using visual studio 6?
Thanks
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 13
Reputation: Poojasrivastava is an unknown quantity at this point 
Solved Threads: 0
Poojasrivastava Poojasrivastava is offline Offline
Newbie Poster

Re: how to connect to a microsoft sql database?

 
0
  #2
Apr 30th, 2009
Originally Posted by mostafanageeb View Post
Please I am now making a project using C# and I want to connect to a database how to do this using visual studio 6?
Thanks

hi..
you can make use of the connectionstring as shown below:

string str = "Data Source=*name of your SQL server*;Initial Catalog=*your database name*;Integrated Security=True";

SqlConnection cn = new SqlConnection(str);

string query="your query statement";
cn.Open();
//
rest of the code!!
//
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC