Jump to content

blishman

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

blishman's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok so here is whats happening: my job is to take a MySQL database and update it regularly using c#...the problem comes when I have to insert new rows to the table.  Using the OdbcDataAdapter, i build the mySQL data into a table, run the update algorithm, which in the current case adds 72 rows to it.  I then try to update it back in by building the insert commands one at a time to add the new rows into the mySQL table, but the problem is that for each time i call the adapter.Update() function, it inserts 72 rows using the value i specify...so that the table looks like this: newcomp1    value  value  value newcomp1    value  value  value ... (70 more times) newcomp2    value  value  value newcomp2    value  value  value here is the code for that portion: complete is the final dataset that contains the machines table's update machines not used in the complete.tables context is the name of the table on the mysql server adapter is the OdbcDataAdapter max2 is the size of the original table max is the size of the updated table             for (int j = max2; j < max; j++) {                 String InsertString = "INSERT INTO machines (machine_name, boot_os, harddrive_size, ram_size, proc_speed) VALUES";                 InsertString += "(\"" + complete.Tables["machines"].Rows[j]["machine_name"].ToString() + "\",\"" + complete.Tables["machines"].Rows[j]["boot_os"].ToString() + "\"," +                     complete.Tables["machines"].Rows[j]["harddrive_size"].ToString() + "," + complete.Tables["machines"].Rows[j]["ram_size"].ToString() + "," +                       complete.Tables["machines"].Rows[j]["proc_speed"].ToString() + ");";                 OdbcCommand insrt = new OdbcCommand(InsertString, test_connection);                 adapter.InsertCommand = insrt;                 adapter.Update(complete, "machines");             } any advice would be greatly appreciated, my email is blishman@fit.edu or my msn messenger is ishma_2002@hotmail.com
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.