Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Getting values of datagridview and exporting it to DBF using oleDB

$
0
0

hello guys good eve.

|  ACCT_NO  |   FIRST_NAME   |  LAST_NAME  |

   200111           john                 wade

   200112           clay                  suede

i can loop to all tables in row. my problem is only 200111 value is pass, written on my database. heres my sample code feel free to commend and change.

 for (int i = 0; i <= dataGridView1.Rows.Count - 1; i++)
                {
                    foreach (var cell in dataGridView1.Rows[i].Cells)
                    {
                        command.CommandText = "INSERT INTO RP_CMG01 (ACCT_NO, LAST_NAME, FIRST_NAME, MID_NAME) VALUES(@ACCT_NO, @LAST_NAME, @FIRST_NAME, @MID_NAME)";
                      
                        command.Parameters.AddWithValue("@ACCT_NO", dataGridView1.CurrentCell.Value);
                        command.Parameters.AddWithValue("@LAST_NAME", dataGridView1.CurrentCell.Value);
                        command.Parameters.AddWithValue("@FIRST_NAME", dataGridView1.CurrentCell.Value);
                        command.Parameters.AddWithValue("@MID_NAME", dataGridView1.CurrentCell.Value);


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>