Home » Posts tagged "OleDbConnection"

Archive for the 'OleDbConnection' Tag

OleDbConnection string with ConfigurationManager

Web config <add name=”MyConnectionString” connectionString=”Data Source=SRV-MY-SQL\SQLCLSTR12; Initial Catalog=MyDatabaseName; Persist Security Info=True;User ID=MyUser;Password=MyPassword” providerName=”System.Data.SqlClient” /> Code behind or markup page ‘defines sql connection Dim connString As String connString = ConfigurationManager.ConnectionStrings(“MyConnectionString”).ToString Dim ConnDB As New OleDbConnection(“Provider=sqloledb;” & connString) ‘define oledbcommand Dim cmd As New OleDbCommand(“SELECT * _ “FROM my_table _ “WHERE name=’Mike’ ;”, ConnDB) Dim reader As […]