[Mono-list] NullReferenceException in Npgsql.NpgsqlCommandBuilder.GetUpdateCommand

Andrus kobruleht2 at hot.ee
Sun Dec 10 19:02:24 EST 2006


I tried the code:

IDbDataAdapter DataAdapter = new Npgsql.NpgsqlDataAdapter();
Npgsql.NpgsqlCommandBuilder builder=
           new Npgsql.NpgsqlCommandBuilder(
                (Npgsql.NpgsqlDataAdapter)DataAdapter);
DataRow row = DataSet.Tables[0].Rows[1];
DataAdapter.UpdateCommand = builder.GetUpdateCommand(row);

But got error in GetUpdateCommand():

System.NullReferenceException was unhandled
  Message="Object reference not set to an instance of an object."
  Source="Npgsql"
  StackTrace:
       at Npgsql.NpgsqlCommandBuilder.BuildSchema()
       at Npgsql.NpgsqlCommandBuilder.GetUpdateCommand(DataRow row, Boolean 
setParameterValues)
       at Npgsql.NpgsqlCommandBuilder.GetUpdateCommand(DataRow row)
       at mynamespace.SaveDataSet() ....

row is assigned to valid row.

Any idea how to fix this ?

Andrus. 



More information about the Mono-list mailing list