Solved

Can Send DataGridView Rows One Time?

Posted on 2008-06-19
3
199 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

729 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