i have to insert data from datagridview to databse

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sandeepdhole
    New Member
    • Feb 2008
    • 3

    i have to insert data from datagridview to databse

    hello friends.......
    i have to insert multiple rows fromdatagridvie w to database.friend s i am inserting a single row by using following code....

    settings.ExeNon Query("insert into RECORD(Filename ,[Filecode],Rackno,[Filegroup],Shelfno,[Month],Remarks) " & _
    " values('" & DataGridView1.C urrentRow.Cells (0).Value & "','" & DataGridView1.C urrentRow.Cells (1).Value & "', " & _
    " " & DataGridView1.C urrentRow.Cells (2).Value & ",'" & DataGridView1.C urrentRow.Cells (3).Value & "', " & _
    " '" & DataGridView1.C urrentRow.Cells (4).Value & "','" & DataGridView1.C urrentRow.Cells (5).Value & "','" & DataGridView1.C urrentRow.Cells (6).Value & "')")
    plz help me ........
    its very urgent......... ............... ...
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi sandeepdhole,

    In order to insert multiple records simply loop through each item in the DataGridView that you wish to insert and run the insert statement for each one.

    Or have i misunderstood the question!?

    Dr B

    Comment

    Working...