ADO parameters are not recognized by SQL Server Mobile 3.1

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I am trying to use ADO select query with parameters in Delphi 7 to
query data from SQLServer Mobile database.
I can successfully query the .sdf database file from Delphi, as long
as the query does not include any parameter statements.
However, if I issue the following command:

with ADOQuery1 do begin
...
SQL.Add('Select * from HISTORY where EVENTKEY =:NextEv');
Parameters.ParamByName('NextEv').Value := 5001;
Open;
...
end;

I get an EOleException Error: "The given type name was unrecognized.
[,,,,,]'

Similarly, using the ADO Insert query or the following ADO Command
produce the same error:
with ADOCommand1 do
begin
CommandText := 'Insert into HISTORY EVENTTYPE,EVENTKEY) VALUES
(7, :NextEv)';
CommandType := cmdText;
Parameters.ParamByName('NextEv').Value := 5005;
Execute;
end;

I have also tried to use the ParseSQL command, but that does not work
either:
ADOQuery1.Parameters.ParseSQL(ADOQuery1.SQL.Text, True);

I use the following ADOConnection ConnectionString in Delphi7:
Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=C:\...
\test.sdf

Does this provider string require any other additional switches ?
It appears to work, as long as I don't try to use any parameters.

What needs to be done to pass the parameters to the SQLServer Mobile
database ?
The above code works without problems with Access database.

Thanks,
Mariusz

.



Relevant Pages

  • RE: ADO parameters are not recognized by SQL Server Mobile 3.1
    ... I can successfully query the .sdf database file from Delphi, ... using the ADO Insert query or the following ADO Command ... What needs to be done to pass the parameters to the SQLServer Mobile ...
    (microsoft.public.sqlserver.ce)
  • Re: ADO parameters are not recognized by SQL Server Mobile 3.1
    ... Erik Ejlskov Jensen, Mobile App Dev MCTS ... I can successfully query the .sdf database file from Delphi, ... using the ADO Insert query or the following ADO Command ...
    (microsoft.public.sqlserver.ce)
  • Re: Building Access Applications "Inventory"
    ... Your form is based on an AutoLookup query that is based on more than one ... database engine saves the entire record, instead of saving only the field ... Set the OnClick property of the command button to the following ... value of the CategoryName field and that no run-time error message appears. ...
    (comp.databases.ms-access)
  • Re: HELP WITH AUTO EXE PROGRAMMING/CODE
    ... I have been working on this Database for roughly about 6 weeks now...I ... QUERY itself...to see if any of the DUEDATES fall within the NEXT TWO ... Automating this Command Button to Run this Code Once a Week...I have ... Dim strsubject As String ...
    (comp.databases.ms-access)
  • Re: Apply filter macro
    ... The first database has a form which opens in data entry ... I have placed a command button on the form ... the command buttons which apply the filters do not seem to ... >> a filter (in the form of a query) to the form. ...
    (microsoft.public.access.macros)