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?
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)
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.