Npgsql.NpgsqlCommandBuilder.GetInsertCommand C# (CSharp) Method

GetInsertCommand() public method

Gets the automatically generated NpgsqlCommand object required to perform insertions at the data source.
public GetInsertCommand ( ) : NpgsqlCommand
return NpgsqlCommand
        public new NpgsqlCommand GetInsertCommand()
        {
            return GetInsertCommand(false);
        }

Same methods

NpgsqlCommandBuilder::GetInsertCommand ( bool useColumnsForParameterNames ) : NpgsqlCommand

Usage Example

示例#1
0
        /// <summary>
        /// DataSet ---NpgsqlDataAdapter ---Database
        /// </summary>
        public NpgsqlDataAdapter GetDataAdapter(string strSQL)
        {
            // Use NpgsqlCommandBuilder and SelectCommand--->Auto generate InsertCommand UpdateCommand DeleteCommand
              try
              {
              m_gCommnd.CommandText = strSQL;
              NpgsqlDataAdapter dataAdapter = new NpgsqlDataAdapter(m_gCommnd);//associate
              //InsertCommand  UpdateCommand DeleteCommand SelectCommand = m_sqlCommand;

              // Initialize the InsertCommand UpdateCommand DeleteCommand of NpgsqlDataAdapter by NpgsqlCommandBuilder.
              NpgsqlCommandBuilder cb = new NpgsqlCommandBuilder(dataAdapter);
              dataAdapter.InsertCommand = cb.GetInsertCommand();
              dataAdapter.UpdateCommand = cb.GetUpdateCommand();
              dataAdapter.DeleteCommand = cb.GetDeleteCommand();
              return dataAdapter;
              }
              catch (System.Exception ex)
              {
              MessageBox.Show(ex.ToString());
              return null;
              }
        }
All Usage Examples Of Npgsql.NpgsqlCommandBuilder::GetInsertCommand