By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,567 Members | 1,670 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,567 IT Pros & Developers. It's quick & easy.

Update one table with another table record

P: 5
Hy...

am having a query regarding updating a table A records from table b on a button click...

have created connection sting and commandtext to exexute d query
am tryn ds query bt it seems to throw some syntax error

Expand|Select|Wrap|Line Numbers
  1. cmd.CommandText = 
  2. "UPDATE stockno_table SET(product_id,Sold,Rec_No)
  3. =(SELECT product_id,Sold,Rec_No from stockno_temp_copy 
  4. where stockno_temp_copy.stock_no=stockno_table.stock_no) where(exists)(stockno_table.stock_no=stockno_temp_copy.stock_no)"
  5.  
basically the fields are same bt the stockno_temp_copy is a temporary table which i want to empty always while it updates all the table records to stockno_table...

all the records except the Sold which is YES/NO field changes...
NB: Access DB is used

Please advice me on this...
Thanx,
Mdoc
Oct 6 '10 #1
Share this Question
Share on Google+
1 Reply


P: 5
anyways I found the solution for the above...
Expand|Select|Wrap|Line Numbers
  1. UPDATE stockno_table inner join stockno_temp_copy on stockno_table.stock_no = stockno_temp_copy.stock_no set stockno_table.Sold = stockno_temp_copy.Sold
  2.  
this is for those having similar probs...

Mdoc
Oct 6 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.