Re: Dynamic SQL generation is not supported against a SelectCommand that does not return any base table information



Setting the SelectCommand is not enough. ADO.NET has to execute a query on
the server to return a set of resultsets that are used to generate the CB
UpdateCommand etc. These are not generated immediately--only when
referenced. You do not have to use the GetInsertCommand or any of those
methods to use the generated code. When you execute Update (for the first
time) the generated code is built and used INSTEAD OF the DataAdapter
UpdateCommand etc. See my article on the CommandBuilder and why it should be
avoided.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Gancy" <ganesh_tiwari@xxxxxxxxxxx> wrote in message
news:1141475222.461553.267530@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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



.



Relevant Pages

  • Re: E-Mail Nachricht an Operator
    ... Man kann ja mit dem SQL Server ... SQL Server-Agent / Operatoren ... EXECUTE msdb.dbo.sysmail_add_account_sp ...
    (microsoft.public.de.sqlserver)
  • Re: Error running sql command
    ... If the commands are in a table on the server, I would create strings on the server and use SQL EXECUTE to execute them... ... I fetch a command from a table, process it and if command executes successfully I delete it form the queue. ... The basic problem with your code is that you are not using SQL Server as it should be used. ...
    (microsoft.public.dotnet.framework.adonet)
  • it all started on 5/27....
    ... individual DTS packages on SQL Server 2000 SP 4 that import and convert ... The SQL lives on a separate server than Pervasive. ... the same machine as SQL Server 2K SP 4. ... Now, if I execute the DTS packages individually on the server, all ...
    (microsoft.public.sqlserver.dts)
  • Re: Executing DTS from Code (correction)
    ... Granting execute permissions on these procs means that external Com objects can be called etc. ... If they run in-process and crash then bye-bye SQL Server. ... I moved the DTS package to the production server and>>> installed the application on the production server. ...
    (microsoft.public.sqlserver.dts)
  • Re: File Upload - Security Issues
    ... uploaded and the user could upload any or all of these in theory. ... There is no one product that can give you 100% security, ... > Code doesn't execute in local memory space unless remote user has rights ... > You don't have MS Office installed on the server. ...
    (microsoft.public.scripting.vbscript)