Welcome Guest Search | Active Topics | Sign In | Register

How to Connect to MS SQL Server DAtabase Options
WalterWilliamsCostaRica
Posted: Wednesday, June 10, 2015 12:54:54 PM
Rank: Newbie
Groups: Member

Joined: 3/18/2015
Posts: 3
In the Samples I can see how to Populate a grid with App_code/demoDb.vb*:
Public Sub New()
Dim dbFileName As String = HttpContext.Current.Request.MapPath("~\App_Data\DICTIO.mdb")
Dim provider As String = String.Format("Provider=""Microsoft.Jet.OLEDB.4.0""; Data Source=""{0}"";", dbFileName)

m_cn = New OleDbConnection(provider)
m_cn.Open()
End Sub 'New
My question is How I can connect to a SQL server Database

Thanks

Walter
WalterWilliamsCostaRica
Posted: Wednesday, June 10, 2015 1:11:11 PM
Rank: Newbie
Groups: Member

Joined: 3/18/2015
Posts: 3
Very Easy. you must change the provider to:
Dim provider As String = "Provider=SQLNCLI; Data Source=SQLSERVER\INSTANce;Initial Catalog=DatabaseNAme;Persist Security Info=True;User ID=USERNAME;Password=USERPASSOWRD"


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.