|
-
Jul 23rd, 2003, 10:26 AM
#1
Thread Starter
Frenzied Member
do while loop
I only want to place the first three records in my comboBox, but this code places all the records in there:
Code:
Do While objDR.Read = True
Me.cmbCards.Items.Add(Trim(objDR("employee_first_name"))
loop
so, I changed the code to:
Code:
Do While counter < 2
Me.cmbCards.Items.Add(Trim(objDR("employee_first_name"))
counter = counter + 1
Loop
but this returned an err msg....no data found...anyone have the proper syntax to do this?
thanks
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Jul 23rd, 2003, 10:35 AM
#2
Addicted Member
I think the reason why it is falling over is because you are not calling the objDR.Read method in the second example while you are looping round
Try:
Code:
Do While counter < 2 and objDR.Read
Me.cmbCards.Items.Add(Trim(objDR("employee_first_name"))
counter = counter + 1
Loop
-
Jul 23rd, 2003, 10:41 AM
#3
Why not just use TOP 3 in your SQL Query.
-
Jul 23rd, 2003, 12:01 PM
#4
Thread Starter
Frenzied Member
thanks VBCoder...Edneeis...theres a TOP command is SQL? Do you have a example?
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Jul 23rd, 2003, 12:11 PM
#5
SELECT TOP 3 * FROM MyTable
-
Jul 23rd, 2003, 12:15 PM
#6
Thread Starter
Frenzied Member
did not know that...thanks
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|