I barely recall my .NET but I think this is dependant upon the Data
Provider you are using, i.e. the SQL Server data provider only uses
named parameters as shown below:

SqlCommand with CommandText of:
SELECT * FROM Customers WHERE CustomerID = @CustomerID

requires a parameter to be added of:
myDataAdapter.SelectCommand.Parameters.Add("@CustomerID",
SqlDbType.VarChar, 10).Value = "CUST056789";

I take it from your FbCommand you are using a different data provider?

Michael Darling
Solution Developer
ROOM Solutions Ltd
mailto:[EMAIL PROTECTED]


-----Original Message-----
From: Cosmin Prund [mailto:[EMAIL PROTECTED] 
>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...
 
--------------------------------------------------------
Room Solutions Limited is a leading supplier of solutions and services to 
non-life commercial insurance markets. Room Solutions Limited is registered in 
England and Wales with company number 2503575. Its registered office is at 100 
New Bridge Street, London EC4V 6YA, United Kingdom. 

CONFIDENTIALITY NOTICE/DISCLAIMER
This email and any attachments are confidential, protected by 
copyright/intellectual property rights and may be legally privileged. The 
information transmitted is intended only for the person or entity to which it 
is addressed. If you are not the intended recipient, dissemination or copying 
of this email is prohibited.
If you have received this in error, please notify us by forwarding this email 
to the following address: [EMAIL PROTECTED] , and then delete the email 
completely from your system.
This email and any attachments have been scanned for computer viruses by a 
market leading anti-virus system. However, it is the responsibility of the 
recipient to conduct its own security measures. No responsibility is accepted 
by ROOM Solutions Limited for loss or damage arising from the receipt or use of 
this email and any attachments.
No responsibility is accepted by ROOM Solutions Limited for personal emails.
ROOM Solutions Ltd, http://www.roomsolutions.net
--------------------------------------------------------

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
_______________________________________________
Delphi-DB mailing list
Delphi-DB@elists.org
http://www.elists.org/mailman/listinfo/delphi-db

Reply via email to