Creating SQL Connection

The following code snippet explains how to create SQL connections. The Parameters used are

Data Source:- Server Name
Initial Catalog:- Database
User ID:- Login ID of SQL
Password:- Password of SQL


Private Function OpenCnn() As SqlConnection
Dim cnnStr As String = "Data Source=Server_Name;Initial Catalog=Database_Name;Persist Security Info=True;User ID=Rabiya;Password=Rabiya123"
Dim con As New SqlConnection(cnnStr)
Return con
End Function


Comments

Author: Ruby C24 Jul 2009 Member Level: Bronze   Points : 0

Good for beginners..
Keep posting..



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: