.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 10th, 2003, 03:32 PM
nazila5165 nazila5165 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 1 nazila5165 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
:: problem in UPDATE statement ::

I want to do something like below(in ASP.NET & C#):

string strupdate = "UPDATE table SET field = field + intvariable WHERE otherfield = yes";

but i don't know how i can do (add a variable value to a numerical field in a ACCESS database).

Please give me the right string.

Reply With Quote
  #2  
Old December 11th, 2003, 11:47 PM
Kovan Kovan is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 80 Kovan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 46 sec
Reputation Power: 0
u first get the value of the field by using SELECT
then u add ur value to it
then u write with UPDATE

so u do something like this

SELECT field FROM table WHERE ....

then u get a dataset back,
u put that value in a variable in ur code
int myVar = myDataSet.Tables[0].Rows[0]
then you add ur new data to that variable

thenn u write back using UPDATE TABLE Set Field = " + myVar.ToString();

....

thats one way of doing it

Kovan,

Reply With Quote
  #3  
Old January 20th, 2004, 10:23 PM
BanksySan's Avatar
BanksySan BanksySan is offline
A mule with a spinning wheel.
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Wales
Posts: 114 BanksySan User rank is Corporal (100 - 500 Reputation Level)BanksySan User rank is Corporal (100 - 500 Reputation Level)BanksySan User rank is Corporal (100 - 500 Reputation Level)BanksySan User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 21 h 6 m 22 sec
Reputation Power: 8
MySpace
You have two methods, constructing a SQL seatment at run time by concatinating strings together or, the faster method, is to create a query in Access. Then use the Command and Parameter objects to run it. I much prefere the second option.

If you are still having problems then post some code and I'll take a gander at it.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > :: problem in UPDATE statement ::


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT