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.


Updating multiple columns in SQLite


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-07-2008, 04:19 AM
Senior Member
 
Join Date: Mar 2008
Posts: 117
Default Updating multiple columns in SQLite

I’m using a table control to make change in multiple columns and want to update those changes in the database by the click event of a button. The numbers of columns to be changed are arbitrary (some time 2 columns, some time 4 columns are to be changed). The statement to update a single column :

cmd.CommandText = "update table-name set column1 = '"&txtbox1.Text&"' where column2= '"& txtbox2.Text& "';"

Then do I have to use as many textboxes as the numbers of columns I want to update? Or there is a way to update the whole table at once without using textboxes?

Please give some guideline.

Thanks and regards
Reply With Quote
  #2 (permalink)  
Old 04-07-2008, 08:19 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,334
Default

Where is the new data stored (textbox, variable...)?
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 03:53 AM
Senior Member
 
Join Date: Mar 2008
Posts: 117
Default

I changed the table's column value directly through a textbox like:

Sub Btnchange_Click
If txtfilter.Text="" Then
Msgbox("No column to change")
Else If Table2.SelectedRow < Table2.RowCount Then
Table2.Cell(Table2.SelectedCol,Table2.SelectedRow) = txtfilter.Text
End If
btnupload.Enabled=true
End Sub

In this way I can change as many columns as it is required.
... ...
... ...

Then can update a single column like:

Sub Btnupload_Click
cmd.CommandText = "update geo set ed = '"&txtfilter.Text&"'where hpid = '"& txtsearch.Text& "';"
cmd.ExecuteNonQuery
End Sub


But the changes made to other columns are not updated.

Thanks for your valuable time.
Reply With Quote
  #4 (permalink)  
Old 04-09-2008, 08:27 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,334
Default

You can update multiple columns by using:
"UPDATE geo SET col1 = 'value1', col2 = 'value2', col3 = 'value3' WHERE ..."
Use Table.Cell to read the values from the table.
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
Deleting multiple files at ones sonavep Questions & Help Needed 2 04-21-2008 04:00 PM
Multiple Listviews tsteward Questions & Help Needed 2 04-20-2008 11:16 AM
Multiple Instances of an application Louis Questions & Help Needed 1 12-23-2007 06:20 AM
How to play multiple sounds at once? justdo Questions & Help Needed 2 09-24-2007 04:59 AM
multiple connections to a sqlite database Peter Questions & Help Needed 5 05-13-2007 08:49 AM


All times are GMT. The time now is 02:16 PM.


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