Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8022861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:23:37+00:00 2026-06-04T22:23:37+00:00

I have an unbound DataGridView with one visible field. The user can copy data,

  • 0

I have an unbound DataGridView with one visible field.

The user can copy data, from the clipboard, into this DGV in a similar manner to this article

Now I’d like to move this data into a table on SQL Server.

It’s been suggested to me to do the following:

  • Create a stored procedure that takes a single parameter and writes that input to a table
  • Loop through the items in the DGV feeding each into the stored procedure and therefore writing them to the table

Can I not just grab all the items in the DGV and insert them into the target table at once, without having to loop?

Or is the loop method (with upto 2,000 iterations) the best practice in such a situation? (Or is there no particular best practice?!)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:23:38+00:00Added an answer on June 4, 2026 at 10:23 pm

    If you are looking at using a stored proc, then you can follow some of the examples of passing arrays of values proposed examples by Erland Sommarskog;

    Take a look at;

    http://www.sommarskog.se/arrays-in-sql-2008.html <- For SS 2008 based around Table Valued Parameters.

    http://www.sommarskog.se/arrays-in-sql-2005.html <- Options for SS 2005. I’ve used the XML method quite a few times and found it quite useful.

    If you are using SS 2008, then you could possibly investigate his example of using the datatable as a source.

    Not sure if these are considered best practice or not, but it is certainly food for thought.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a datagridview in form 1 which contains unbound data. How can I
On a Windows form I have an unbound datagridview with 1 user-editable column. A
I have few columns in my DataGridView, one of them is an unbound column
I have a DataGridView with unbound data that contains three different DataColumns . The
I have a DataGridView in a Winforms app that has about 1000 rows (unbound)
I'm using c#2.0 and WinForms. I have a datagridview control, unbound, loading small amounts
So I have an unbound form that I use to save data to a
I have a datagridview (unbound). Fields are Name, Family Name and Phone No and
I have this class with an unbound method and a static class inside: class
I have html like this: <div> <input type=checkbox id=checkbox, checked=checked/> <label for=checkbox>Copy values</label> </div>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.