Link to home
Start Free TrialLog in
Avatar of Navicerts
NavicertsFlag for United States of America

asked on

ADO, select two columns from an SQL statement and store as variables

Hello,

Currently i am using ADO to select the information ffrom one record and store that result into a variable (Sire).  what i would like to do is select two columns from that same sql statement and store the results in two diffrent variables.  here is the section of code that handles one variable right now....


        'Retrive sire code from the female that needs to be placed and stores it into the "Sire" variable
        SQL = "SELECT Sire FROM Females WHERE Wingband =" & WingbandInput.Text & ";"
        rsT.Open(SQL, conn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockUnspecified)
        Sire = rsT.GetString
        Sirelbl.Text = Sire
        Wingbandlbl.Text = WingbandInput.Text
        rsT.Close()


The problem is the "rsT.GetString" line will take all the results into a string, i want something like this with the two spots i left blank filled in.

        'Retrive sire code from the female that needs to be placed and stores it into the "Sire" variable
        SQL = "SELECT Sire, Pen FROM Females WHERE Wingband =" & WingbandInput.Text & ";"
        rsT.Open(SQL, conn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockUnspecified)
        Pen =
        Sire =
        Sirelbl.Text = Sire
        Wingbandlbl.Text = WingbandInput.Text
        rsT.Close()

Thanks!

-Navicerts
ASKER CERTIFIED SOLUTION
Avatar of Arthur_Wood
Arthur_Wood
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Navicerts

ASKER

Thank you sir
Glad to be of assistance.

might I ask why you are using ADO and not ADO.NET?  ADO.NET is a much improved database interaction tool, and it would be a good idea for you to get familiar with it.

AW

I was just trying to throw something together for the boss real quick, but i will be making more permanant things working ahead that i would like to use whatever the "freshest" technology is (if anything just so it can be maintained longer).

Do you know a good place i can go to get an overview of the diffrences between the two?

Thanks for ths tip!

-Navicerts
Please see

Q_21420617.html

Thanks!