![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
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 |
|
||||
|
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. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |