Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,
I am doing my project(desktop application) using vs2008 in c#.net & sql server2005,
i took a listview on my form & from textboxes on same form i added that data to listview ,now i want to save my listview dta to data base ..


database filds & textboxes are
description of goods,quantity,rate,per,amount,total.
the list view data should b save in this database within perticular fields....

Please provide me code sample for it



Thanks in advance


[edit]SHOUTING removed, urgency removed, textspeak removed, tags - OriginalGriff[/edit]
Posted
Updated 13-Aug-11 21:59pm
v2
Comments
OriginalGriff 14-Aug-11 4:00am    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.
Urgency deleted: It may be urgent to you, but it isn't to us. All that your stressing the urgency does is to make us think you have left it too late, and want us to do it for you. This annoys some people, and can slow a response.
Please use English rather than txtspk.

There are a number of reasons:
1) txtspk is seen as "childish" by many members - you have a keyboard, use it. That reduces the chance of misunderstandings.
2) This is an international site. Many members come from countries where English is not their native langauge: India, China, The United States of America. If you use txtspk then is difficult if not impossible for them to understand, as most of your post will not be in any dictionary.
Mario Majčica 14-Aug-11 4:01am    
I love gimmecode tag!

So the basis of the implemenation is that you:
- create a connection: SqlConnection[^] and open it
- create a command: SqlCommand[^] and use bind variables in it: SqlParameter[^]
- start a transaction: SqlTransaction[^]
- now you loop through the list view and change the values of the parameters and use ExecuteNonQuery[^] to execute the statement
- after the loop commit [^]the changes
- close the connection and dispose the objects
 
Share this answer
 
Here are lists of Introduction to ADO.NET and Bind to ListBox Tutorial
1.Introduction to ADO.Net, [MSDN][^]
2.An introduction to ADO.NET[^]
3.Server-side ASP .NET Data Binding[^]
 
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