how to search database and display matching record in vb6
I have vb form that accepts input from user,search in database(database acess) and displays matching records if any in the listview .The problem is that the search query will display only one matching record even if there are many matching records
.anyone please help
Dim xRecords As Integer
rs.MoveFirst 'change rs to whatever you have named your recordset selector
For xRecords = 1 To rs.RecordCount
''Do with this record returned what you need to...
Your problem is the rs(x) part. You can loop through records but not through fields...
Well you can, but that is a totally different issue which is quite complex. :)
What you need to do is to change your code to -
Dim li1 As ListItem
''Dim x As Integer
Do Until rs.EOF
Set li1 = LV1.ListItems.Add()
''For x = 1 To 7 Don't need this...
List.SubItems(1) = rs!FieldName1
List.SubItems(2) = rs!FieldName2
List.SubItems(3) = rs!FieldName3
Whats happening is that you will start with record one and add it to your listview coloumn by coloumn.
rs will then move to the next and so on adding each rows data to your listview.
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...