Home > DeveloperSection > Forums > How to connect sql database server to vb.net?
Ankita Pandey
Ankita Pandey

Total Post:183

Points:1285
Posted on    October-21-2014 12:45 AM

 MSSQL Server Database  SQL  SQL Server 2012  Database Connection 
Ratings:


 1 Reply(s)
 726  View(s)
Rate this:
how to connect sql database server to vb.net?


Pravesh Singh

Total Post:411

Points:2881
Posted on    October-21-2014 12:46 AM

You can hardcode it like this
 Collapse | Copy Code
var connection = New System.Data.SqlClient.SqlConnection(connectionString)
connection.Open()

or you can do it more independently 

var factory = System.Data.Common.DbProviderFactories.GetFactory(providerString)
var connection = factory.CreateConnection()
connection.ConnectionString = connectionString
connection.Open()

Modified On Oct-21-2014 12:47:04 AM

Don't want to miss updates? Please click the below button!

Follow MindStick