Friday, March 30, 2012

MS SQL This feature has not been implemented yet

Hi, I'm a Delphi programmer, and using an ADO Dataset, I'm trying to select some data from a database. However, when I set it up using parameters, I get an error in Delphi that this Feature has not been implemented yet. Can anyone help me configure the MS SQL database, so I can run SQL queries with parameters?which version of Delphi and SQL are you using. I use D6 with SQL 2k and have no problems (well, almost none) using an ADO dataset. What is your sql statement and how did you define your parameters?|||I am using Delphi version 7 and MS SQL 2000. Here is the Commandtext from my ADODataset:

select count(*) from CallDetail calldetail where i3timestampgmt between :BegTime and :EndTime and initiateddate between :BegTime2 and :EndTime2 and LocalUserId = :User

If I plug in actual values in the SQL instead of parameters, the script runs just fine. Then here is how I defined the parameters:

dmReports.ADODataSet1.Parameters.ParamByName('BegT ime').Value := FormatDateTime('mm/dd/yyyy hh:nn', BegDate);
dmReports.ADODataSet1.Parameters.ParamByName('EndT ime').Value := FormatDateTime('mm/dd/yyyy hh:nn', EndDate + 1);
dmReports.ADODataSet1.Parameters.ParamByName('BegT ime2').Value := FormatDateTime('mm/dd/yyyy hh:nn', BegDate);
dmReports.ADODataSet1.Parameters.ParamByName('EndT ime2').Value := FormatDateTime('mm/dd/yyyy hh:nn', EndDate + 1);
dmReports.ADODataSet1.Parameters.ParamByName('User ').Value := workgroupmembers[i];
dmReports.ADODataSet1.Active := True;
ShowMessage(dmReports.ADODataSet1COLUMN1.AsString) ;

At the beginning of the procedure I defined them like this:

BegTime, EndTime, BegTime2, EndTime2, User: Variant;|||your declarations seem ok at first sight. My guess would be to change the parameter named 'user' to another name because this is keyword used by sql server.|||I tried changing User to Operator, and it is still giving the exact same error. I am guessing that the MS SQL is not configured correctly, and maybe under the current configuration it can't handle parameters.|||I don't see how it could be configured to not accept parametrized queries from a client application. What is the exact error message you get? If you click on the parameters property in the object inspector, does it display all your parameters correctly?|||In the object inspector all the parameters are displayed correctly. Here is the message that I receive

--------
Debugger Exception Notification
--------
Project report.exe raised exception class EOleException with message '[Microsoft][ODBC SQL Server Driver]Optional feature not implemented'. Process stopped. Use Step or Run to continue.
--------
OK Help
--------|||There is nothing to configure in sql server to allow it to accept queries.
Depends on what is being sent to the server by the app as to whether it will work.
Try using the sql server profiler to trace what is being sent.

Check the delphi documentation and the provider you are using as the error is comming probably comming from one of these|||see http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q214/4/59.asp&NoWebContent=1 for more info.|||I just ran the SQL Server Profiler from the Server, and that query is not even showing up there. I know that it connects however, because when I run a query without the parameters, it does show up.

Also, I beleive that the Microsoft website is talking about Visual Basic, instead of Delphi.|||Thanks for all your help jora and nigellrivett. I couldn't get it working, so I decided that instead of using parameters, I'd set the commandtext property directly with the right values in a procedure in Delphi.sql

No comments:

Post a Comment