Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

SQL BLOB problem

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-08-2007, 09:13 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Netherlands
Posts: 222
Default SQL BLOB problem

Erel,

Still, I do not succeed to read a BLOB. The coding I use is as indicated by you:

Dim blob(0) as Byte

Sub Button4_Click
Cmd.CommandText = "SELECT * FROM WPOILABEL_V1"
Reader.Value = Cmd.ExecuteReader
Do While Reader.ReadNextRow = TRUE
blob() = Reader.GetBytes(4)
Label1.Text=blob()
'Do what you need with the bytes array.
Loop
Reader.Close
End Sub

On the line blob() = etc. I get the message:Input string was not in a correct format.

According to SQLite Expert column 4 ( and 5) are blobs and do contain information.

The data base concerned is UTF-16le encoded. I have attached the data base.

Any idea what is going wrong?

Harry
Reply With Quote
  #2 (permalink)  
Old 05-08-2007, 09:58 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

The problem is with this line:
Label1.text = blob()

blob() is an array of bytes. You can't assign it directly as a string.
See this code:
Code:
Sub Globals
    
dim blob(0as byte
End Sub

Sub App_Start
    con.New1
    con.Open(
"Data Source = " & AppPath & "\igo.db")
    cmd.New1(
"SELECT * FROM WPOILABEL_V1", con.Value)
    Reader.New1
    reader.Value = cmd.ExecuteReader
    Reader.ReadNextRow
    blob() = reader.GetBytes(
4)
    
for i = 0 to ArrayLen(blob()) - 1
        textBox1.Text = textBox1.Text & blob(i)  & 
","
    
next
    form1.Show
    reader.Close
End Sub
You could use the Bitwise library to convert it to hex values.
I'm not sure what is stored in the BLOB columns and in what format. You will need to check it.
Reply With Quote
  #3 (permalink)  
Old 05-08-2007, 10:38 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Netherlands
Posts: 222
Default SQL BLOB problem

Erel,


Sorry, but the problem is really in the line:

blob() = reader.GetBytes(4)

The error message is : Input string was not in a correct format.

If I remove all further coding the error remains.

I do not know what is meant with 'input string': the BLOB itself or the code line as input to the SQL process or to .NET?

Harry
Reply With Quote
  #4 (permalink)  
Old 05-08-2007, 10:58 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

I've attached the example.
Make sure you are working with the updated SQL libraries.
Attached Files
File Type: zip BLOB.zip (25.9 KB, 34 views)
Reply With Quote
  #5 (permalink)  
Old 05-08-2007, 12:46 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Netherlands
Posts: 222
Default SQL BLOB problem

Erel,

Thanks and sorry! The old dll's were still in the application path!

Harry
Reply With Quote
  #6 (permalink)  
Old 05-10-2007, 08:25 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Netherlands
Posts: 222
Default SQL BLOB problem

Erel,

I was too optimistic. The example you sent me works fine on the desktop. But on the PDA I get the message: "Error loading program. \Programmabestanden\Basic4PPC-programma's\test\SQLDevice.dll."

SQLDevice.dll really is in the path indicated. It's version is 1.0.2656.38193.

The same problem occurs with my own program.

Am I again doing something wrong?

Harry
Reply With Quote
  #7 (permalink)  
Old 05-10-2007, 10:48 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

There are two possible reasons:
1) The .Net CF 2.0 is not installed properly: www.basic4ppc.com/netcf2.html
2) The SQL library is not installed properly: www.basic4ppc.com/Downloads.html
Reply With Quote
  #8 (permalink)  
Old 05-10-2007, 01:08 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Netherlands
Posts: 222
Default SQL BLOB Problem

Erel,

There is progress again and also the next problem/question. The program starts and the data base is opened. However, when the following statements are executed its is reported that there is no such table: WPOILABEL_V1:

Cmd.CommandText = "SELECT * FROM WPOILABEL_V1"
Reader.Value = Cmd.ExecuteReader

That table really exists!

On the desk top everything works fine. The data base is UTF-16le encoded(!).

Do you understand the different behaviour and do you have a solution?

Harry
Reply With Quote
  #9 (permalink)  
Old 05-10-2007, 02:19 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

I've checked the program I've send you on the device and it works properly.
If you want you can send me your code.
Reply With Quote
  #10 (permalink)  
Old 05-10-2007, 06:13 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Netherlands
Posts: 222
Default SQL BLOB Problem

Erel,

Finally I got it running. It was due to one or more small coding errors I made. I have the impression that SQLite on the DeskTop is more forgiving than SQLite on the PDA. Therefore debugging was difficult; it did run on the DeskTop and not on the PDA.

Thanks for your help.

Harry
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 Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question: BLOB-Data within Tablecontrol ? schaujo Questions (Windows Mobile) 2 01-27-2008 05:49 PM
blob & image dennishea Questions (Windows Mobile) 13 08-31-2007 08:02 AM


All times are GMT. The time now is 05:47 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0