Yep, that was it! Named parameters are prefixed with "@", not with ":"
I expected ":" to be the prefix since this is the prefix in Firebird's 
stored procedure / trigger language, and in IbExpress'es framework. 
Doing a quick search in the documentation solved it.

Thanks for the tip,
Cosmin Prund

David Colliver wrote:
> The question mark is database dependent.
>
> For example, SQL Server has named parameters... (though this could be 
> through the SQL Server provider)
>
> select * from tab where name = @tab
>
> X.Parameters.Add("@tab", DbType.String).Value = "tab";
>
> MySQL uses question marks as well, and I think Access does.
>
> However, you can use named items in your .Parameters.Add (I do it all the 
> time), just have your parameters in the same order as your question marks.
>
> Hope this helps.
>
> Best regards,
> Dave Colliver.
> http://www.AshfieldFOCUS.com
> ~~
> http://www.FOCUSPortals.com - Local franchises available
>
> ----- Original Message ----- 
> From: "Cosmin Prund" <[EMAIL PROTECTED]>
> To: "Moderated discussion list about database programming with Borland's 
> Delphi" <delphi-db@elists.org>
> Sent: Wednesday, January 24, 2007 11:35 AM
> Subject: ASP.NET / ADO.NET query parameters by name
>
>
>   
>> Hello everyone.
>>
>> I'm learning ASP.NET and in the process I need to learn ADO.NET; The
>> syntax for defining and using a SQL query that makes use of parameters
>> seems really difficult to me, so I hope I'm actually missing something.
>>
>> This is what I'm doing now:
>>
>> procedure Test;
>> var X:FbCommand;
>> begin
>>  X := FbCommand.Create('SELECT * FROM TAB WHERE ID=?', Connection,
>> Transaction);
>>  X.Parameters.Add('', DbType.&String).Value := '7';
>>  X.ExecuteReader; // etc
>> end;
>>
>> This is strange to me because it forces me to use "?" marks for
>> parameters (difficult to maintain) and it forces me to refer to those
>> parameters by POSITION (difficult to maintain). In the Win32 world I
>> would have used named parameters and that's really easy to maintain.
>>
>> Am I missing something? I sure hope I'm missing something...
>>
>> Thanks,
>> Cosmin Prund
>> _______________________________________________
>> Delphi-DB mailing list
>> Delphi-DB@elists.org
>> http://www.elists.org/mailman/listinfo/delphi-db 
>>     
>
> _______________________________________________
> Delphi-DB mailing list
> Delphi-DB@elists.org
> http://www.elists.org/mailman/listinfo/delphi-db
>
>   

_______________________________________________
Delphi-DB mailing list
Delphi-DB@elists.org
http://www.elists.org/mailman/listinfo/delphi-db

Reply via email to