Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all visitors
i have 1 table(salesdetail) in sql server 2008
in this table, i have 3 fields(code,itemcode,qty)
in vb.net, i create one form and drop DataGridView on that form
i also set 5 columns on DataGridView(Itemcode,IteamName,Qty,price,Total)
i user sql statement like this ("select itemcode,itemanem,price from item where itemcode=' & txtitemcode.text & "'"")
i use this query to display the item information to my gridview.
when i input 3 items on gridview, i want to save all item in gridView to my table(salesorder)
Note
i want to save only code,itemcode,qty to my salesdetail, for itemname,price,total use for display only.

Please help me how i can save data from gridView to my table?

Best Regards,
TONY
Posted

1 solution

You can use SqlDataAdapter[^] to reflect changes in the datagridview (or actually in the datatable) to the database.

For example see: http://msdn.microsoft.com/en-us/library/fbk67b6z.aspx[^]

Another note: Don't concatenate literals in your SQL statements ("select itemcode,itemanem,price from item where itemcode=' & txtitemcode.text & "'""). Instead use parameters. More info: SqlParameter [^]
 
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