G
Gancy
Hi,
I have data access tier designed in such a way, just by changnging
application settings, same lines of code is made to work with both MS
SQL Server or MS Access. Code works fine with MS SQL Server. however
while executing following code lines on MS Acess
ds = new DataSet();
oAdapter.SelectCommand.CommandText = this.SelectCommand;
oAdapter.SelectCommand.Connection = oConn;
if (idbType == (int) ApplicationConstants.DBType.SQLServer)
{
oAdapter.DeleteCommand = sqlCommandBuilder.GetDeleteCommand();
oAdapter.InsertCommand =
sqlCommandBuilder.GetInsertCommand();
oAdapter.UpdateCommand =
sqlCommandBuilder.GetUpdateCommand();
}
else if (idbType == (int) ApplicationConstants.DBType.Access)
{
oAdapter.DeleteCommand =
oleCommandBuilder.GetDeleteCommand();
oAdapter.InsertCommand =
oleCommandBuilder.GetInsertCommand();
oAdapter.UpdateCommand =
oleCommandBuilder.GetUpdateCommand();
}
return oAdapter.Fill(ds);
It throws out the following error
System.InvalidOperationException was unhandled
Message="Dynamic SQL generation is not supported against a
SelectCommand that does not return any base table information."
But i have defined primary keys on all tables in Access databasel, just
like what i have in MS Sql database. Just to avoid this error i can
not use explict Insert, Delete or Update command for Adapter as the
same lines of code (above) has to work with 15 diff tables.
Any suggestions to this?
Thanks & Regards
Ganesh
I have data access tier designed in such a way, just by changnging
application settings, same lines of code is made to work with both MS
SQL Server or MS Access. Code works fine with MS SQL Server. however
while executing following code lines on MS Acess
ds = new DataSet();
oAdapter.SelectCommand.CommandText = this.SelectCommand;
oAdapter.SelectCommand.Connection = oConn;
if (idbType == (int) ApplicationConstants.DBType.SQLServer)
{
oAdapter.DeleteCommand = sqlCommandBuilder.GetDeleteCommand();
oAdapter.InsertCommand =
sqlCommandBuilder.GetInsertCommand();
oAdapter.UpdateCommand =
sqlCommandBuilder.GetUpdateCommand();
}
else if (idbType == (int) ApplicationConstants.DBType.Access)
{
oAdapter.DeleteCommand =
oleCommandBuilder.GetDeleteCommand();
oAdapter.InsertCommand =
oleCommandBuilder.GetInsertCommand();
oAdapter.UpdateCommand =
oleCommandBuilder.GetUpdateCommand();
}
return oAdapter.Fill(ds);
It throws out the following error
System.InvalidOperationException was unhandled
Message="Dynamic SQL generation is not supported against a
SelectCommand that does not return any base table information."
But i have defined primary keys on all tables in Access databasel, just
like what i have in MS Sql database. Just to avoid this error i can
not use explict Insert, Delete or Update command for Adapter as the
same lines of code (above) has to work with 15 diff tables.
Any suggestions to this?
Thanks & Regards
Ganesh