Information générale
Catégorie:
The Mere Mortals .NET Framework
Titre:
SaveSelectCommand blows up when tableName is empty
Kevin,
In 1.3 beta 4, mmDataAccessSql.FillDataSet(DataSet ds, IDbDataAdapter dbAdapter,
string tableName, bool clearOnFill)
you check for an empty tableName parameter before calling adapter.fill()
if (!mmString.Empty(tableName))
{
// Fill the specified table in the DataSet
adapter.Fill(ds, tableName);
}
else
{
//Fill dataset, with table being named according to SQL rules
adapter.Fill(ds);
}
but then with
// Store the current select command for the current table in the
// DataTable's extended properties
this.SaveSelectCommand(ds, tableName, dbAdapter);
you atempt to use the empty tablename to retrieve a table reference from the dataset:
if (ds.Tables[tableName].ExtendedProperties.Contains("SelectCommand"))
which causes "Object reference not set to an instance of an object."
Thanks,
Max...
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement