<p> </p>
<p class="imp-signature"><!--begin_signature--><br /></p>Zitat von Bo Berglund <bo.berglund@gmail.com>:<br /> <br />
> On Sun, 23 Jan 2011 18:23:25 +0100, "Dipl. Phys. Jörg Schläger"<br />
> <js@jsdevelop.de> wrote:<br />
><br />
>><br />
>> Zitat von Bo Berglund <bo.berglund@gmail.com>:<br />
>><br />
>>> On Sun, 23 Jan 2011 13:53:45 +0100, "Dipl. Phys. Jörg Schläger"<br />
>>> <js@jsdevelop.de> wrote:<br />
>>><br />
>>>><br />
>>>> and next you might think of using query.SQL.Text := 'EXEC<br />
>>>> SelectDongleData @@SerialNo=2485';<br />
>>><br />
>>> Tried adding an extra @ to parameter.<br />
>>> Results are as follows:<br />
>>><br />
>>> EXEC SelectDongleData @@SerialNo=2485<br />
>>><br />
>>> 'Cannot open a non-select statement'<br />
>>><br />
>>> EXECUTE SelectDongleData @@SerialNo=2485<br />
>>><br />
>>> 'Could not execute statement. ODBC error details: LastReturnCode:<br />
>>> SQL_ERROR; Record 1: SqlState: 42000; NativeError: 8145; Message:<br />
>>> [Microsoft][ODBC SQL Server Driver][SQL Server]@@SerialNo is not a<br />
>>> parameter for procedure SelectDongleData.;'<br />
>><br />
>> of course you have to change your sql statement to define @@SerialNo<br />
>><br />
>> procedure SelectDongleData @@SerialNo int AS<br />
><br />
> Why?<br />
> It is already defined as follows:<br />
><br />
> CREATE PROC dbo.SelectDongleData<br />
> @SerialNo int = 0<br />
> AS<br />
><br />
> I don't see the reason to add another @ in the declaration. Can you<br />
> explain this a bit?<br /><br />I agree there is no reason, but it is from MS with historie <br />local variable: declare @SerialNr int<br />in versions before MSsql 2008 @@ referr a <strong>global</strong> variable that is the different<br />depending on server and client I had some problems with local variable declaration on some client config/version.<br /><br />-- <br />
Dipl. Phys. Jörg Schläger<br /><br /><br />
><br />
> --<br />
> Bo Berglund<br />
> Developer in Sweden<br />
><br />
><br />
> --<br />
> _______________________________________________<br />
> Lazarus mailing list<br />
> Lazarus@lists.lazarus.freepascal.org<br />
> <a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br />
><br /><br />
<br />
----------------------------------------------------------------<br />
Dip. Phys. Jörg Schläger<br />
Auftragsentwicklung Meßtechnik<br />
www.jsdevelop.de<br />
<br />