I am trying to upgrade a website from Visual Studio 2003 to VS 2005, taking advantage of some of the new controls and features available. In the VS 2003 version, I am accessing data in the VB code using a connection object. In the VB 2005 version, I would like to create an SQLDataSource object in design view. My question is, how do I get a look at the data in the VB code behind module in order to code against it?
For exampe, I have the following code in my Visual Basic code behid module:
Dim conn As OleDbConnection = New OleDbConnection(System.Con
figuration
.Configura
tionManage
r.AppSetti
ngs("Conne
ctionStrin
g"))
Dim cmd As New OleDbCommand(loginSQL, conn)
Dim dbReader As OleDbDataReader
conn.Open()
Try
dbReader = cmd.ExecuteReader()
If dbReader.Read Then
If (dbReader.GetBoolean(dbRea
der.GetOrd
inal("Hide
"))) Then
lblErrorMsg.Text = "Your EC3 account has been deactivated. Please see your EC3 administrator."
lblErrorMsg.Visible = True
Exit Sub
End If
Session("SSN") = (dbReader.GetString(dbRead
er.GetOrdi
nal("Socia
l Security Number")))
Session("UserName") = (dbReader.GetString(dbRead
er.GetOrdi
nal("Full Name")))
Session("Security") = (dbReader.GetString(dbRead
er.GetOrdi
nal("Secur
ity")))
Session("Access") = (dbReader.GetBoolean(dbRea
der.GetOrd
inal("All Consumers")))
dbReader.Close()
conn.Close()
checkPrefs()
blErrorMsg.Visible = False
Response.Redirect("testfor
m.aspx")
Else
lblErrorMsg.Text = "User Name and/or Password invalid."
lblErrorMsg.Visible = True
dbReader.Close()
conn.Close()
End If
Finally
conn.Close()
End Try
How can I do this using the SQLDataSource I have set up to execute the SQL?
Start Free Trial