Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Sqlite


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-18-2007, 02:43 AM
Senior Member
 
Join Date: Jul 2007
Posts: 139
Default Sqlite

I am having problems understanding syntax of using sqlite.

INSERT INTO WorkTable ( Internal, ColdOd, ColdFp )
VALUES ( textbox1.text, textbox2.text, textbox3.text)

I think the above is laid out right but I don't understand how to use it in basic4ppc. I have gotten bits and pieces from examples to work but am still having trouble. Would appreciate any help with this.

dennishea
Reply With Quote
  #2 (permalink)  
Old 08-18-2007, 04:58 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,849
Default

There is no special Basic4ppc SQL syntax.
Basic4ppc just passes the command string to the SQLite engine.
You should test your actual command string using msgbox(cmd.CommandText) or using a breakpoint.
In your example I guess you are adding strings and not numbers so you need:
cmd.CommandText = "INSERT ... VALUES('" & textBox1.Text & "','" & textbox2.Text & "','" & textBox3.Text & "')"
Notice the small apostrophes.

Last edited by Erel : 08-18-2007 at 03:56 PM. Reason: Removed an extra quote.
Reply With Quote
  #3 (permalink)  
Old 08-18-2007, 03:23 PM
Senior Member
 
Join Date: Jul 2007
Posts: 139
Default Sqlite

@Erel

I have tried to follow your example and the first problem was to get it to unremark the last half of the code, there is a double quote behind textbox1.text that doesn't belong there, but it still doesn't add my data to the db. I have converted a csv file to a sql database and have been able to read it into a table but that is as far as I have been able to get. I'm trying to learn how to add and delete records with no success. I have been to a few web sites that show the sql statements and I think I understand them and at this point I think it's basic4ppc that I'm confused with. I know that you have done an excellent job with basic4ppc. I guess it's one of those blond moments when I just can't see the forest for the trees. Please bare with me.

dennishea

edit:
Yay Got adding a record sorted out and working.

Last edited by dennishea : 08-18-2007 at 03:54 PM. Reason: let you know
Reply With Quote
  #4 (permalink)  
Old 08-18-2007, 03:58 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,849
Default

Thank you for the correction.
Can you show some segment of the code?
Reply With Quote
  #5 (permalink)  
Old 08-18-2007, 05:52 PM
Senior Member
 
Join Date: Jul 2007
Posts: 139
Default sqlite

Yes
I've got the insert statement working and now I'm fighting with update. I pretty much tried to copy the demosql example. This seems to work all the way up to cmd.executenonquery then it kicks out

cmd.executenonquery
error description:
sqlite error
near "0000":snytax error

The textbox1 has AA 0000 in my where statement, I don't know if that's what it's refering to or what. I thought I would keep it simple to get my feet wet but in the end I would like to update the whole record not just one field.

Sub btnUpDate_Click
text="update WorkData set ColdFP = " & textbox2.Text
text=text & " where Internal = " & textbox1.Text
cmd.CommandText=text
Msgbox(cmd.CommandText)
cmd.ExecuteNonQuery
End Sub

Thanks for your support.

dennishea
edit:
@Erel
With a lot of reading I have a handle on the basics with sqlite, "creating, inserting, updating, and deleteing". Between your example above and your other example of northwind.sl3 I finally sorted it out. Thanks Again Erel for your support.

Last edited by dennishea : 08-19-2007 at 08:17 AM.
Reply With Quote
  #6 (permalink)  
Old 08-19-2007, 05:41 PM
Senior Member
 
Join Date: Jul 2007
Posts: 139
Default sqlite

Well I have a new problem. My program runs fine on pc and ppc as long as I run them from the ide's but when I compile them device gives a nullreference error and pc says something about sqldesktop.dll format not being right.



dennishea
Reply With Quote
  #7 (permalink)  
Old 08-19-2007, 06:09 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 582
Default

Hi dennishea,

since the sql library needs .Net CF2, have you added a ApplicationName.exe.config (as a copy from Dbasic.exe.config) to your compiled application?


specci48
Reply With Quote
  #8 (permalink)  
Old 08-20-2007, 12:45 AM
Senior Member
 
Join Date: Jul 2007
Posts: 139
Default sqlite

Hi specci48.
Yes, I checked and there is one there. I am new to these librarys. I tried to read as much as I can but you can rely on murphy's law, if something can go wrong it will. I hope it is just a simple over site on my part. Thanks for your suggestion.

dennishea
Reply With Quote
  #9 (permalink)  
Old 08-20-2007, 11:58 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,849
Default

When distributing an SQL compiled application you should also distribute:
- A config file (for .Net CF 2.0)
- System.Data.SQLite.dll (there is a desktop and a device version files).

There is an example of a compiled sql application here:
http://www.basic4ppc.com/files/SQLCompiled.zip
It includes a Device and a Desktop folders with the files required (TreeView.dll and Northwind.sl2 are not required).
Reply With Quote
  #10 (permalink)  
Old 08-20-2007, 04:24 PM
Senior Member
 
Join Date: Jul 2007
Posts: 139
Default sqlite

Hi Erel, I checked the directorys and and tried to duplicate what I thought I was seeing. The only thing that wasn't in my directory was a file named like my DeskData.exe with config on the end. When I installed 5.50 I didn't uninstall the last version of basic4ppc. I wasn't sure what file to rename to my program name with config on the end so I tried dbasic.exe.config and when that didn't work there was a basic4ppc.exe.config and I tried that with no luck. The dbasic.exe.config gave way more error's then I can type about. The basic4ppc.exe.config version just says I don't have the right version of .net framework. My program compiled with no errors for both pc and ppc.
Both uncompiled versions work on pc & ppc. I know that it has to be something I am over looking.

dennishea

edit:

I did rename both config files one at a time to DeskData.exe.config. I think that's what I am suppose to do?
I need system.data.sqlite.dll , SQLDeskTop.dll , DeskData.exe , deskData.exe.config I think all in the same directory.

Last edited by dennishea : 08-20-2007 at 04:32 PM.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQLite magi6162 Questions & Help Needed 3 06-18-2008 02:36 PM
SQLite Joserra Spanish Forum 2 01-27-2008 12:57 AM
SQLite and .NET CF 1.0 Mac Questions & Help Needed 4 08-16-2007 07:37 PM
SQLite 3 DLL Ver 1.2 alfcen Questions & Help Needed 4 05-19-2007 10:39 AM


All times are GMT. The time now is 07:18 PM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0