Click here to Skip to main content
15,916,280 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello!
For me ask, I import file DBF(Database Foxpro) from button browse file and this database it show on datagridview, now, i need help me : when i click button SAVE,it will fetch all row of datagridview,then it save to SQL server Database.
Posted

1 solution

Then you need to loop through the grid view

please follow this algorithm
C#
decalre rwcount as bitint
For (rwcount <> gridview.rows.count )rwcount
 {
    //  Connect DB
    // Prepare query string for insert 
       "Insert into table1 (col1,col2,col3) Values (' " + gridview.row[rwcount].column[0].value  
           + "','" +gridview.row[rwcount].column[0].value + "','"  +gridview.row[rwcount].column[0].value       +  "')" 
    // Run the above qury sting
      rwcount=rwcount+1
  }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900