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.

More SQL questions

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-03-2008, 05:27 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Netherlands
Posts: 222
Default More SQL questions

Hi everybody,

I have to add a number of fields to a table if those fields do not already exist.
I have been playing around with IF NOT EXISTS, but I don't get it working.

Also, I have no idea how to intercept error messages from SQlite; then I could just ignore certain error codes, a.o the error if a field already exists.

With VB I have done quite complicated things with SQL; may be that the problem is that I try to do it in the same way.

Are there some SQLite experts among the forum members?

Harry
Reply With Quote
  #2 (permalink)  
Old 01-03-2008, 05:44 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

I'm not a SQLite expert.
Also try sqlite site: http://www.sqlite.org/support.html

For now it is not possible to catch error messages with the ErrorLabel method.
It is high in the ToDo list and will be available in the near future.
Reply With Quote
  #3 (permalink)  
Old 01-04-2008, 10:15 AM
Knows the basics
 
Join Date: Oct 2007
Location: Berkshire, UK
Posts: 76
Awards Showcase
Beta Tester 
Total Awards: 1
Default

I am definitely no SQLite expert either!

However a simple method could be - do a SELECT * on the table and open it with DataReader, then use FieldCount to test if the fields exist. Finally do ALTER TABLE with an ExecuteNonQuery, if needed.

Alternatively, if you need more column information, use ExecuteTable instead, then the Table control's ColCount and ColName properties.

Just a suggestion.
Geoff.
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
A few questions regarding FormLib N1c0_ds Questions (Windows Mobile) 6 09-19-2008 02:34 AM
Newbie Questions Bruno Questions (Windows Mobile) 2 05-05-2008 06:45 PM
Questions on SpecialKeys HARRY Questions (Windows Mobile) 5 02-26-2008 01:55 PM
One of my stupid questions.... Cableguy Questions (Windows Mobile) 7 01-27-2008 10:26 AM
SQL Questions tcgoh Questions (Windows Mobile) 7 12-31-2007 09:10 AM


All times are GMT. The time now is 01:45 AM.


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