User-1188570427 posted
I need help converting the code below to connect to an access database. Thanks.
Using: vb web developer 2008, access db, asp.net
Dim mainconnection As New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("connectTOtblsch").ConnectionString)
Using SQLConn As New Data.SqlClient.SqlConnection(SqlDataSource1.ConnectionString)
Using SQLcmd As New Data.SqlClient.SqlCommand(SqlDataSource1.SelectCommand, mainconnection)
SQLcmd.Connection = SQLConn
SQLcmd.CommandType = CommandType.Text
SQLcmd.Parameters.Clear()
SQLcmd.Parameters.AddWithValue("@DateIn", TrainDate)
SQLConn.Open()
linkStr = ""
Using reader As SqlDataReader = SQLcmd.ExecuteReader(CommandBehavior.CloseConnection)
If reader.HasRows Then
While reader.Read()
RmName = reader("Name")
LeaveStatus = reader("Status")
linkStr = "<span style=""font-size:9pt; font-Weight:bold; color:red""><br />" &
RmName & _
"(" & LeaveStatus & ")</a></span>"
e.Cell.Controls.Add(New LiteralControl(linkStr))
End While
End If 'reader.HasRows
End Using
End Using
End Using