Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
problem passing perameter in insert command genareted by SqlCommandBuilder

Answered problem passing perameter in insert command genareted by SqlCommandBuilder

  • Thursday, September 13, 2012 11:49 AM
     
      Has Code

    I have genareted insert command using sqlcommandbuilder ...

    need to pass some perameter with the that command ...

    I have write something like ...

     SqlDataAdapter adepter = new SqlDataAdapter("select * from " + destinationtablename + "_errors", sqlcon);
                                        SqlCommandBuilder sbc = new SqlCommandBuilder(adepter);
                                        adepter.InsertCommand = sbc.GetInsertCommand();
                                        adepter.InsertCommand.Parameters.AddWithValue("@Run_id", DXC_run_id);

     SqlDataAdapter adepter = new SqlDataAdapter("select * from " + destinationtablename + "_errors", sqlcon);
                                        SqlCommandBuilder sbc = new SqlCommandBuilder(adepter);
                                        adepter.InsertCommand = sbc.GetInsertCommand();
                                        adepter.InsertCommand.Parameters.AddWithValue("@Run_id", DXC_run_id);

     It works fine when i call 

    adepter.Update(dt);

    but there is no value for Run_id column in row in the table...

All Replies