ADO parameters are not recognized by SQL Server Mobile 3.1
- From: EliteHerd@xxxxxxxxx
- Date: Sun, 16 Sep 2007 22:26:02 -0700
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
.
- Follow-Ups:
- Prev by Date: Requirements for replication
- Next by Date: RE: ADO parameters are not recognized by SQL Server Mobile 3.1
- Previous by thread: Requirements for replication
- Next by thread: RE: ADO parameters are not recognized by SQL Server Mobile 3.1
- Index(es):
Relevant Pages
|