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 3 DLL Ver 1.2


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-17-2007, 01:31 PM
alfcen's Avatar
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu
Posts: 424
Default SQLite 3 DLL Ver 1.2

Hi gang,
I am generating a table with TEXT, REAL, NUMERIC and BLOB class columns.
Trying to write a string consisting of both numbers and alphabets,
such as "16h30m34s" into a TEXT class column.
A that point an error message prompts:

Invalid token "16h30m34s"

Is this perhaps a limitation of SQLite?

The SQL Database Browser has no such problems.

Thanks a lot!
Robert
Reply With Quote
  #2 (permalink)  
Old 05-17-2007, 02:54 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,954
Default

This is a simple string and there shouldn't be any problem adding it to the db.
Did you use single quotes ' before and after the string?
Reply With Quote
  #3 (permalink)  
Old 05-19-2007, 09:31 AM
alfcen's Avatar
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu
Posts: 424
Default

Hi Erel,
The source may say word than words (I tried with 's, no better):

Sub insertpic_Click
cmd.New1("CREATE TABLE IF NOT EXISTS exoplanets (rarad REAL,derad REAL,Name TEXT,Constellation TEXT,RA TEXT,Dec TEXT,Dist NUMERIC,Mag NUMERIC,Msun NUMERIC,Mjup NUMERIC,Period NUMERIC,a NUMERIC,ex NUMERIC,Spectral TEXT,image BLOB)",con.Value)
cmd.ExecuteNonQuery
fileOpen(c1,"exoplanets.csv",cread)
zt=fileRead(c1)
do until zt=EOF
zt=fileRead(c1)
v()=gps.StrSplit(zt,",")
cmd.CommandText = "INSERT INTO exoplanets values("&v(0)&","&v(1)&","&v(2)&","&v(3)&","&v(4)& ","&v(5)&","&v(6)&","&v(7)&","&v(8)&","&v(9)&","&v (10)&","&v(11)&","&v(12)&","&v(13)& "," & cmd.FileToBLOB(AppPath & "\images\" & v(14)) & ")"
cmd.ExecuteNonQuery
loop
fileClose(c1)

'cmd.CommandText = "SELECT image FROM exoplanets"
'reader.Value = cmd.ExecuteReader
'reader.ReadNextRow
'Image1.Image = reader.GetImage(0)
End Sub
Reply With Quote
  #4 (permalink)  
Old 05-19-2007, 10:02 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,954
Default

Each string that is inserted into the db should be wrapped with single quotes.
Try something like:
v()=gps.StrSplit(zt,",")
For i = 0 To 13
v(i) = "'" & v(i) & "'"
Next
...

BTW, you should use connection.BeginTransaction at the beginning of this sub and connection.EndTransaction at the end. It will improve the speed of the data insert.
Reply With Quote
  #5 (permalink)  
Old 05-19-2007, 10:39 AM
alfcen's Avatar
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu
Posts: 424
Default

Thanks a lot for help, Erel, I will try it.
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 dennishea Questions & Help Needed 15 08-23-2007 11:39 AM
SQLite and .NET CF 1.0 Mac Questions & Help Needed 4 08-16-2007 07:37 PM


All times are GMT. The time now is 06:01 PM.


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