|
-
Apr 16th, 2010, 05:39 AM
#1
Thread Starter
Addicted Member
How do I use variables in a SQL statement in vb.net 2008
I got this in my SQL statement. I "BOLDED" the problem.
Code:
SELECT OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry FROM Orders
WHERE CustomerID = @CustomerID
I saw a video tutorial on the internet, http://msdn.microsoft.com/en-us/vbasic/cc138242.aspx where they are doing this. The example that I inserted is actually from the tutoral. For some reason it wont work on my side.
How do I use variables in a SQL statement?
-
Apr 16th, 2010, 05:44 AM
#2
Frenzied Member
Re: How do I use variables in a SQL statement in vb.net 2008
suppose you want the value of @CustomerID to be the value inputted by the user in textbox1,then:
Code:
OledbCommandObject.Parameters.AddWithValue("@CustomerID",textbox1.text)
Last edited by gautamshaw; Apr 16th, 2010 at 06:27 AM.
If you find my reply helpful , then rate it
-
Apr 16th, 2010, 10:05 AM
#3
Re: How do I use variables in a SQL statement in vb.net 2008
Follow the Blog link in my signature about Parameters in ADO.NET for more information.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|