Results 1 to 4 of 4

Thread: Insert DataGridview into database

  1. #1
    Join Date
    Feb 2009
    Posts
    62

    Insert DataGridview into database

    I have made a search function that uses my DataGridView1 to choose what to show in DataGridView2. I have made a search function that uses my DataGridView1 to choose what to show in DataGridView2. If I click on a parameter in the INPUT_LIMITS column in DataGridView1 and then click button2 DataGridView2 is filled with data from the INPUT_LIMITS table that have GroupID with the same value as the parameter I clicked on. I'm not sure how to "cycle" through all my DataGrid rows and collect the cell values, store in variables and then store in a DataTable in VB or directly to SQL database table for insert of all rows and values from my DataGrid.

  2. #2
    Join Date
    Feb 2006
    Posts
    214

    Re: Insert DataGridview into database

    Office automation is always a tricky business, especially when you wish to take data from Excel and place it into a relational database. Fill the information in the controls in the footer and then click on save button in the footer and bind grid again on click of save button. Not knowing the specifics, I would recommend you look at several things. dgTargeted.DataSource = dsCLISalesBudget.Tables("tblSalesBudgetTarget") do some(CRUD) stuff in your grid. then make your database table look,have,only contain whats inside your grid daCLISalesBudget.Update(dsCLISalesBudget, "tblSalesBudgetTarget")

  3. #3
    Join Date
    Nov 2008
    Posts
    43

    Re: Insert DataGridview into database

    First, Excel interprets data as numeric or string according to its own rules, and will often reveal numeric data as formatted, you you may be better off first placing the information into character fields in SQL Server (in a loading table) then converting to the correct data type there. You can communicate with the database by either a tableAdapter or by using by typing all commands (create a connection, create a command, execute command).

  4. #4
    Join Date
    Feb 2006
    Posts
    90

    Re: Insert DataGridview into database

    The most common way of inserting values is by the use of string concatenation. I am able to insert the controls dynamically like text box,combo and checkbutton but i am enable to view the controls. controls r visible when i am click the mouse at that particular grid cell. I am putting some source code line We will concatenate all the values into sql string command and when the concatenation is complete we will have a long string representing all the insertions which can later be send to the command object to be executed.

Similar Threads

  1. insert into select statement for database
    By Aidan 12 in forum Software Development
    Replies: 5
    Last Post: 09-03-2010, 10:08 PM
  2. Unable to update my database using insert command
    By Govardhann in forum Software Development
    Replies: 5
    Last Post: 13-02-2010, 11:10 AM
  3. Replies: 5
    Last Post: 05-01-2010, 11:58 AM
  4. How to update Database with Changes made to the DataGridView
    By afidelino in forum Software Development
    Replies: 3
    Last Post: 25-09-2009, 08:41 AM
  5. Insert image in access database from vb 6.0
    By Vireshh in forum Software Development
    Replies: 2
    Last Post: 22-01-2009, 09:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,723,612.85426 seconds with 17 queries