Re: Parameter object is improperly defined. Access vs MSSQL
- From: "Vitali Kalinin" <vitkalinin@xxxxxxxxx>
- Date: Wed, 29 Jun 2005 15:35:34 +0300
MS Access and MS SQL implementations for DML are quite different. For MS SQL
you should use something like this:
declare @SurveyID GUID, @QuestionID LONG, @SessionID LONG
set @SurveyID = :SurveyID
set @QuestionID = :QuestionID
set @SessionID = :SessionID
SELECT NULL AS Extended, Count(*) AS IntValue, NULL AS AValue
FROM Answers AS A
WHERE (A.SurveyID= @SurveyID ) AND (A.QuestionID = @QuestionID ) AND
(A.Extended <> 0)
UNION ALL
SELECT A.Extended, F.IntValue, F.TextValue as AValue
FROM Answers AS A INNER JOIN FilledSurveys AS F ON (A.SurveyID=F.SurveyID
AND A.QuestionID=F.QuestionID AND A.AnswerID=F.IntValue AND F.SessionID =
@SessionID )
WHERE (A.SurveyID= @SurveyID ) AND (A.QuestionID = @QuestionID )
If you need generic solution for this specific case you use procedure like
this for parameters assignment:
Procedure AssignParameter(ADataSet : TADODataSet; AName : string; const
AValue : Variant);
Var
I : Integer;
Begin
For I := 0 to ADataSet.Parameters.Count - 1 do with
ADataSet.Parameters[i] do begin
If CompareText(Name, AName) = 0 then begin
Value := AValue;
End;
End;
End;
However you should be aware that there are a lot of others differences
between MS SQL Server and Access.
Regards,
Vitali
.
- References:
- Parameter object is improperly defined. Access vs MSSQL
- From: Mike Meyer
- Parameter object is improperly defined. Access vs MSSQL
- Prev by Date: Update and insert in one sql statement in access error
- Next by Date: Re: "unique table" problem
- Previous by thread: Parameter object is improperly defined. Access vs MSSQL
- Next by thread: Re: Parameter object is improperly defined. Access vs MSSQL
- Index(es):
Relevant Pages
|