scope identity - invalid ParamType
Posted: Mon 13 Sep 2010 15:56
Hello,
i am new with uniDAC since yesterday
Now i have a problem with scope identity.
I have a Test-Application with a Insert INTO -Statement with one parameter... It will work perfect:
Then i tried the same in another application with a SQL-Statement with 50 Parameters. The statement will work until i add the following lines:
Now i get this exception:
Parameter[51]:id - invalid ParamType (Status = 1h).
I use MS SQL 2005. What will here going wrong?
I tried the code from the Testapplication with the same Database from the other application. No error... i really don`t understand it...
After searching in the forum, i tried to put the line:
into the "BeforeUpdateExecute" event handler. The exception will be gone, but the id will always 0
What can i do to find the failure?
Thanks a lot for your help...
Andy
i am new with uniDAC since yesterday

Now i have a problem with scope identity.
I have a Test-Application with a Insert INTO -Statement with one parameter... It will work perfect:
Code: Select all
UniQuery1.Active := false;
UniQuery1.SQL.Clear;
UniQuery1.SQL.Add('INSERT INTO test (name) VALUES (:name)');
UniQuery1.Params.ParamByName('name').Value := Edit1.Text;
UniQuery1.SQL.Add('SET :id = SCOPE_IDENTITY()');
UniQuery1.Params.ParamByName('id').DataType := ftInteger;
UniQuery1.Params.ParamByName('id').ParamType := ptInputOutput;
UniQuery1.Execute;
Label1.Caption := UniQuery1.ParamByName('id').AsString;
Code: Select all
UniQuery1.SQL.Add('SET :id = SCOPE_IDENTITY()');
UniQuery1.Params.ParamByName('id').DataType := ftInteger;
UniQuery1.Params.ParamByName('id').ParamType := ptInputOutput;
Parameter[51]:id - invalid ParamType (Status = 1h).
I use MS SQL 2005. What will here going wrong?
I tried the code from the Testapplication with the same Database from the other application. No error... i really don`t understand it...

After searching in the forum, i tried to put the line:
Code: Select all
UniQuery1.Params.ParamByName('id').ParamType := ptInputOutput;
What can i do to find the failure?
Thanks a lot for your help...
Andy