boatdrinks
IS-IT--Management
I have this select statment where I am selecting a bunch of fields and would like to set them all as variables. Originally I used a separate select statement for each field. This is my idea of how this should work, but id doesn't.
Dim connectionString As String = ("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath("SupportRequests.mdb"))
Dim oleConnection As New OleDBConnection(connectionString)
oleConnection.Open()
Dim oleCommand = New OleDbCommand("Select firstname as fname, lastname as lname, hardware as hw, software as sw, problem as prob, importance as imp, barcode as barcode FROM requests where ticket = " & request.Querystring("id"))
oleCommand.Connection = oleConnection
fname = oleCommand.ExecuteScalar()
lname = oleCommand.ExecuteScalar()
hw = oleCommand.ExecuteScalar()
sw = oleCommand.ExecuteScalar()
prob = oleCommand.ExecuteScalar()
imp = oleCommand.ExecuteScalar()
barcode = oleCommand.ExecuteScalar()
oleConnection.Close()
Dim connectionString As String = ("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath("SupportRequests.mdb"))
Dim oleConnection As New OleDBConnection(connectionString)
oleConnection.Open()
Dim oleCommand = New OleDbCommand("Select firstname as fname, lastname as lname, hardware as hw, software as sw, problem as prob, importance as imp, barcode as barcode FROM requests where ticket = " & request.Querystring("id"))
oleCommand.Connection = oleConnection
fname = oleCommand.ExecuteScalar()
lname = oleCommand.ExecuteScalar()
hw = oleCommand.ExecuteScalar()
sw = oleCommand.ExecuteScalar()
prob = oleCommand.ExecuteScalar()
imp = oleCommand.ExecuteScalar()
barcode = oleCommand.ExecuteScalar()
oleConnection.Close()