Advertisement

06.25.2007 at 11:37AM PDT, ID: 22656507
[x]
Attachment Details

How do you use the SQLDataSource object in the VB code behind module?

Asked by monacoassociates in Visual Basic Programming, Visual Studio

Tags: ,

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.Configuration.ConfigurationManager.AppSettings("ConnectionString"))
Dim cmd As New OleDbCommand(loginSQL, conn)
Dim dbReader As OleDbDataReader
conn.Open()

Try
   dbReader = cmd.ExecuteReader()

   If dbReader.Read Then
      If (dbReader.GetBoolean(dbReader.GetOrdinal("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(dbReader.GetOrdinal("Social Security Number")))
      Session("UserName") = (dbReader.GetString(dbReader.GetOrdinal("Full Name")))
      Session("Security") = (dbReader.GetString(dbReader.GetOrdinal("Security")))
      Session("Access") = (dbReader.GetBoolean(dbReader.GetOrdinal("All Consumers")))
     dbReader.Close()
      conn.Close()
      checkPrefs()
      blErrorMsg.Visible = False
      Response.Redirect("testform.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
[+][-]06.25.2007 at 01:24PM PDT, ID: 19358873

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2007 at 10:25AM PDT, ID: 19365908

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2007 at 11:04AM PDT, ID: 19366246

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Basic Programming, Visual Studio
Tags: sqldatasource, vb
Sign Up Now!
Solution Provided By: traxion
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.26.2007 at 11:11AM PDT, ID: 19366292

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2007 at 01:22PM PDT, ID: 19367516

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2007 at 02:29PM PDT, ID: 19367994

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2007 at 02:45PM PDT, ID: 19368121

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.27.2007 at 06:48AM PDT, ID: 19372178

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.11.2007 at 02:19PM PDT, ID: 19677132

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08.18.2007 at 12:52PM PDT, ID: 19723599

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08.22.2007 at 05:50PM PDT, ID: 19750738

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32