943,776 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 1034
  • C# RSS
Apr 30th, 2009
0

how to connect to a microsoft sql database?

Expand 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
Similar Threads
Reputation Points: 4
Solved Threads: 0
Newbie Poster
mostafanageeb is offline Offline
6 posts
since Jan 2008
Apr 30th, 2009
0

Re: how to connect to a microsoft sql database?

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!!
//
Reputation Points: 11
Solved Threads: 0
Newbie Poster
Poojasrivastava is offline Offline
13 posts
since Apr 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Symmetric Vs Asymmetric Encryption
Next Thread in C# Forum Timeline: ADO.NET ExecuteNonQuery Problem (Dashes in the string)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC