Navicerts
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.adOpe nStatic, ADODB.LockTypeEnum.adLockU nspecified )
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.adOpe nStatic, ADODB.LockTypeEnum.adLockU nspecified )
Pen =
Sire =
Sirelbl.Text = Sire
Wingbandlbl.Text = WingbandInput.Text
rsT.Close()
Thanks!
-Navicerts
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.adOpe
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.adOpe
Pen =
Sire =
Sirelbl.Text = Sire
Wingbandlbl.Text = WingbandInput.Text
rsT.Close()
Thanks!
-Navicerts
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
ASKER
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
Do you know a good place i can go to get an overview of the diffrences between the two?
Thanks for ths tip!
-Navicerts
ASKER
Please see
Q_21420617.html
Thanks!
Q_21420617.html
Thanks!
ASKER