Solved

Can Send DataGridView Rows One Time?

Posted on 2008-06-19
3
195 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now