Cursor not initialized Error

giga

Well-Known Member
Licensed User
Longtime User
:BangHead:

Please help. I can't see why this is not working.

in Debug mode I get Cursor not initialized
Code:
Sub Load_Click

 
Dim cursor1 As Cursor

txt= "SELECT company, name, address, city, state, zip, FROM clients WHERE company = '" & txtBox1.Text & "'"  
cursor1=SQL1.ExecQuery(txt) 
cursor1.Position=0
txtBox1.Text=cursor1.GetString("company")
txtBox2.Text=cursor1.GetString("name")
txtBox3.Text=cursor1.GetString("address")
txtBox4.Text=cursor1.GetString("city")
txtBox5.Text=cursor1.GetString("state")
txtBox6.Text=cursor1.GetString("zip")
txtBox7.Text=cursor1.GetString("email")
txtBox8.Text=cursor1.GetString("")


End Sub

Thanks in advance
 
Try this:
Code:
Sub Load_Click
   Dim Cursor1 As Cursor
   'Assuming you have a company name stored in txtBox1
   txt= "SELECT company, name, address, city, state, zip, email FROM clients WHERE company = '" & txtBox1.Text & "'"  
   Cursor1=SQL1.ExecQuery(txt) 
   Cursor1.Position=0
   txtBox2.Text=Cursor1.GetString("name")
   txtBox3.Text=Cursor1.GetString("address")
   txtBox4.Text=Cursor1.GetString("city")
   txtBox5.Text=Cursor1.GetString("state")
   txtBox6.Text=Cursor1.GetString("zip")
   txtBox7.Text=Cursor1.GetString("email")
End Sub
 
Upvote 0
Is this Library for use with Microsoft SQL Server only or can also work with MYSQL?

The SQL library uses SQLITE by default. If you wish to connect to other MYSQL I believe there are routines out there, try a search of the forums.

Code:
    Cursor1=SQL1.ExecQuery(txt)

After this line you should check for number of results before trying to retrieve the data.

Code:
   If Cursor1.RowCount > 0 Then
 
Upvote 0
Back
Top