Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select Statement
Message
 
To
17/04/2003 15:23:33
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00778464
Message ID:
00779243
Views:
26
>do you know of any example of doing parametirized queries.

Here is a simple one. Basically you define the parameter in the SQL statement by prefixing it with "@" - You then use the Parameters.Add method to set its value.
Try
   Dim sc As New SqlCommand()
   sc.Connection = oConn <--- you SQL Connection object goes here
   sc.CommandText = "select myfield from mytable where myfield = @MyValue"
   sc.Parameters.Add("@MyValue", "somevalue" )
   x = sc.ExecuteScalar()
Finally
   oConn.Close()
End Try
Hector Correa
Previous
Reply
Map
View

Click here to load this message in the networking platform