Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with MYSQL and Select * from <tablename>

Status
Not open for further replies.

devilman0

IS-IT--Management
Nov 14, 2002
257
US
I have a problem with the below code in vb, i am using a dsn less connection to the db and everythign else works except:

Code:
select * from JobInfo

do until recordset.eof
i=i+1
recordset.movefirst
recordset.move i-1
tempstr = tempstr & recordset(0) & "~"
loop
this doesn't raise an error in vb just returns null for each field, also if I do:

Code:
select job_id, Job_Number from JobInfo
recordset.movefirst
do until recordset.eof
recordset.movenext
tempstr = tempstr & recordset(0) & "~"
loop
that works part way, ie, i get all the requested records except the first one. any thoughts?

BTW this only doesn't work in mysql, both ways work when using a .mdb

sorry for the cross post, but i tried mysql, then realized this may be a vb problem requireing more attention in the vb fourm


Thanks,
James
[afro][mad]
"Make it idiot-proof and someone will make a better idiot." ~bumper sticker
 
Figured it out, For those who may be having the same problem here's my code:
Code:
Public Sub LoadCmbBox()
Dim RecordSet As New ADODB.RecordSet
Dim StrSql As String
On Error Resume Next
If DBConnection.State <> adStateOpen Then
Path = ReadIni(&quot;Main&quot;, &quot;Path&quot;, App.Path & &quot;\Settings.ini&quot;)
Call Main(Path & &quot;\JobIformation.mdb&quot;)
End If
StrSql = &quot;Select job_id, Job_Number from JobInfo ORDER BY job_id&quot;
RecordSet.ActiveConnection = DBConnection
RecordSet.Open StrSql
RecordSet.MoveFirst
JobInformation.Combo1.Clear
FrmHelperWindow.CmbJobs.Clear
Do Until RecordSet.EOF
JobInformation.Combo1.AddItem RecordSet(1)
FrmHelperWindow.CmbJobs.AddItem RecordSet(1)
RecordSet.MoveNext
Loop
Exit Sub
ErrOccured:
End Sub

Thanks,
James
[afro][mad]
&quot;Make it idiot-proof and someone will make a better idiot.&quot; ~bumper sticker
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top