Home » 2012 » November

Archive for November, 2012

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 […]

Array – using array (vb.net) to update multiple records

‘Dim RecIDRE As String = Request.Form(“reId”) If Not RecID = 0 Then Try ‘define sql conn Dim connString As String connString = ConfigurationManager.ConnectionStrings(“MySQLConnectionString1”).ToString Dim conn As New SqlConnection(connString) Dim cmd As New SqlCommand() conn.ConnectionString = connString conn.Open() Dim printArray As Array = RecID.Split(“,”) Dim i As Integer For i = 0 To printArray.Length – 1 […]