Click here to Skip to main content
15,898,987 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to add stock-in product in product table?
example: If I add an additional product, it adds number of product in products table. I'm working an Inventory.

thanks.
Posted
Updated 24-Jul-12 16:05pm
v5
Comments
ianshack 22-Jul-12 21:29pm    
yes sir on how to insert it, but I want to know on how to add an additional number of quantity in my quantity column in my table. I'm working with inventorying products.
Kenneth Haugland 22-Jul-12 21:32pm    
You have to tell me what you want. Do you really want to add a new column in the SQL sercer? Or do you want to just add one column in the datatable?

Im a bit confused...
ianshack 22-Jul-12 21:44pm    
sir, I have already my sample products table(prod_id, prod_name, quantity) and I want to update the products table to add an addtional number of products. If I click the update button the number of quantity didn't update.
[no name] 22-Jul-12 21:55pm    
Well then you seriously need to update your question with what you have tried to do and what happened that you did not expect to happen.
Kenneth Haugland 22-Jul-12 21:51pm    
This is normally done through adding a row, not a column... If you want more help, you should proivide us with a code snipplet were you add the data to the database.

update mytable set mycolumn = mycolumn + 1
 
Share this answer
 
Comments
ianshack 29-Jul-12 21:46pm    
thanks for the idea sir, I really appreciate it.
Christian Graus 29-Jul-12 21:49pm    
Sorry for the wait, I typed this and the site did not post it, then I just found it sitting here when I came back to this computer :-)
ianshack 29-Jul-12 21:52pm    
I only change the + 1 into the value of my textbox control.
Here is my query:
"update product set prodName ='" & prodNameTextBox.Text & "', Quantity = Quantity + '" & (qtyTextBox.Text) & "' where prodId ='" & prodIdTextBox.Text & "'"
Christian Graus 29-Jul-12 22:01pm    
This is really bad. You should not build SQL this way, it means anyone can erase your entire DB, just by changing those text box values. You should read up on SQL Injection attacks.
ianshack 31-Jul-12 0:35am    
sir, can you give me example of update statement or revise my query statement to protect from SQL Injection attacks.
Something like this perhaps?

ALTER TABLE table_name
ADD column_name datatype
 
Share this answer
 
Comments
[no name] 22-Jul-12 21:26pm    
I don't think that is what he is after.
Kenneth Haugland 22-Jul-12 21:30pm    
I notist now... but imn not so sure....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900