About SQL Database

gjoisa

Active Member
Licensed User
Longtime User
Hi
I have created a database called "Atlas.sl3" with SQL . My question is, how to get the first field of a record with key ? My intention is to get the first fields of all records in a list , when i type 1 or 2 letters in a textbox and clicking a button . eg: when i type 'A' ,all first fields of records (Agra , Ajmer , Ahmedabad) starting with "A" should be added to a listbox . how to write the coding ?
 

willisgt

Active Member
Licensed User
On each key press (I presume the user is typing into a text box), create and execute a new sql query, like such:

"SELECT field1,field2,field3 FROM (your_table_name) WHERE field1 LIKE '" & textbox1.text & "%' "

Be warned, this method can be slow, especially if you've got a lot of data. You might consider reading the contents of the database into a table, and extracting only the records matching your search - especially if the data won't be modified by the user.

Gary
 
Last edited:

gjoisa

Active Member
Licensed User
Longtime User
thank you for your suggession . now i have problem in compiling after setting database actions .there comes one error message about SQL . pls help me .
 
Last edited:

gjoisa

Active Member
Licensed User
Longtime User
the error message reads so ;"Error Compiling Program . Error message : Error CS0012 : The type 'System.Data.Common.DBConnection' is defined in an assembly 'System.Data,Version=2.0.0.0, Culture=neutral,PublicKeyToken=b77a5c561934e089'.Line Number=25 . Line:Com.New1("""",con.Value)" .

I have added System.data.SQLite.dll in both desktop and device(seperately as required) in components . I used here 'com' for command . I think this much can help you to understand my problem .
 

gjoisa

Active Member
Licensed User
Longtime User
i have added the dll files as directed by you . After when tried to compile there is another error message :Error CS00234: The type or namespacename 'SQLite' does not exist in the namespace 'System.data" .(Are you missisng an assembly reference?) .what does it mean ? what to do ?:sign0085:
 

gjoisa

Active Member
Licensed User
Longtime User
I have added the dll files just sent by you . still there is error message .Error CS0246: The type or namespace name 'SQL' couldnot be found .(Are you missing a using directive or an assembly reference ?)
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
As I wrote you in a previous post, you should replace SQLDesktop.dll with the updated file.
Currently you are using SQLDesktop.dll from 3/14/2007.
You should replace it with the one from 11/25/2007.
You could download it in post #10 of this thread.
Afterwards your application compiles fine.

Don't forget that you should also distribute System.Data.SQLite.dll which is located under:
C:\Program Files\Anywhere Software\Basic4ppc Desktop\Libraries\SQLNative
 
Top