[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Can Send DataGridView Rows One Time?

Posted on 2008-06-19
3
Medium Priority
?
204 Views
Last Modified: 2012-06-22
Salam

I have a datagridview , and has many rows of data , now I want to connect to sql server table.
Can I send data one time . or I have to make For Each row in .....

0
Comment
Question by:Ahmadal_najjar2003
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
cpleong99 earned 2000 total points
ID: 21820659
Normally we will issue each sql insert/Update statement one time for each record.

However, if you want to improve the performance, you can issue a big SQL statement which consists of multiple Insert statement, for example:

strSQL = "Insert into tableA values (1,X,X)  " & vbcrlf & "Insert into tableA values (2,Y,Y)   "  & vbcrlf & "Insert into tableA values (3,Y,Y)"

Execute the sql Statement one time and it will insert 3 rows into the table.

However, you need to knows that you have less control on the above method, because you might fail in one of the row, but others record already inserted.

Anyway, it is really fast compare to insert 1 by 1, if you have let say 1000 lines to insert...

0
 

Author Comment

by:Ahmadal_najjar2003
ID: 21821067
It is good Idea. But As you say if I have 1000 lines. But Why Not May In the future I need it.

Thanks a lot .
0
 

Author Closing Comment

by:Ahmadal_najjar2003
ID: 31468686
Thanks A lot
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question