I am trying to establish a connection with sql server but i am not able to do so. Can some one help me out?
jeffreylee
0
Newbie Poster
Recommended Answers
Jump to Postpublic void connect() { SqlConnection connection = new SqlConnection("connectionString"); try { connection.Open(); } catch { // Show error } finally { connection.Close(); } }
Don't forget to add
System.Data.SqlClient
reference to project.
Jump to PostYou can create a new connection from Server Explorer and copy connection strings from properties in your project. Following link contains steps to create connection from Server Explorer
http://msdn.microsoft.com/en-us/library/s4yys16a(v=VS.90).aspx
You can …
All 5 Replies
jugosoft
25
Junior Poster in Training
Mitja Bonca
557
Nearly a Posting Maven
watsonsimler
0
Newbie Poster
vdixit01
0
Newbie Poster
vdixit01
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.