S serdar New Member Licensed User Longtime User Mar 28, 2012 #1 Hello and thanks for great app. I have a simple SQlite table with one autoincrement and one text fields and I populated Listview with table showing only the text fields. Then I select a row to get Position value to delete or edit text field. But Position Value does not match with actual autoincrement number. Is there a way to get selected records autoincrement field value in Listview without listing actual autoincrement value itself ? Serdar,
Hello and thanks for great app. I have a simple SQlite table with one autoincrement and one text fields and I populated Listview with table showing only the text fields. Then I select a row to get Position value to delete or edit text field. But Position Value does not match with actual autoincrement number. Is there a way to get selected records autoincrement field value in Listview without listing actual autoincrement value itself ? Serdar,
NJDude Expert Licensed User Longtime User Mar 28, 2012 #2 You could save the records from the database to a List, in this case you will save the autoincrement field, so, when the user click on the list view, you use the index of the list view to grab the autoincrement value and retrieve your record from the DB. Last edited: Mar 28, 2012 Upvote 0
You could save the records from the database to a List, in this case you will save the autoincrement field, so, when the user click on the list view, you use the index of the list view to grab the autoincrement value and retrieve your record from the DB.
Ricky D Well-Known Member Licensed User Longtime User Mar 28, 2012 #3 That's the easiest way to do it cheers, Ricky Upvote 0
S serdar New Member Licensed User Longtime User Mar 28, 2012 #4 Thank you for help it works. But filling Listview and a seperate List takes a long time and memory for long tables with a lot of fields. I figured that I can extract autointeger KeyValue within Itemclick Sub. Provided that Text value is unique. Thanks Serdar, Code: Sub Listview1_ItemClick (Position As Int, Value As Object) Dim KeyValue as Int KeyValue=SQL1.ExecQuerySingleResult("SELECT AutoInt FROM MyTable WHERE Text='" & Value & "'") End Sub Upvote 0
Thank you for help it works. But filling Listview and a seperate List takes a long time and memory for long tables with a lot of fields. I figured that I can extract autointeger KeyValue within Itemclick Sub. Provided that Text value is unique. Thanks Serdar, Code: Sub Listview1_ItemClick (Position As Int, Value As Object) Dim KeyValue as Int KeyValue=SQL1.ExecQuerySingleResult("SELECT AutoInt FROM MyTable WHERE Text='" & Value & "'") End Sub
F flandersdl Member Licensed User Longtime User Mar 28, 2012 #5 Are you using .AddSingleLine2? You could put the auto increment in the ReturnValue and then use it to delete or edit the text. Upvote 0
Are you using .AddSingleLine2? You could put the auto increment in the ReturnValue and then use it to delete or edit the text.
S serdar New Member Licensed User Longtime User Mar 28, 2012 #6 No. Using .AddSingleLine only. Upvote 0
F flandersdl Member Licensed User Longtime User Mar 28, 2012 #7 Look at .AddSingleLine2. This is the easiest way to do what you want. Upvote 0