Solved

Can Send DataGridView Rows One Time?

Posted on 2008-06-19
3
194 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks A lot
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

744 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

15 Experts available now in Live!

Get 1:1 Help Now