-
I am trying to pass a SQL to the DataEnvironment at run time
ysing the Command1_click event:
DataEnvironment1.Commands("orders").CommandText=_
SELECT account FROM orders WHERE account="12345";
And I get syntax error in FROM clause so I change tosee where the problem is to:
SELECT * FROM orders
And still get the same error what am I doing wrong?
-
I suggest using RecordSet objects instead of Command objects. Then you can change the query sentence without any problems.
-
You properly have to work with the command parameters.
Go to the command properties and set by the SQL statement
you SQL string like "SELECT * FROM [orders] WHERE [account]=?". let it end with "?" so the command would generate a parameter. when you have done this you have to define the parameter by the parameter tab. So i see you want to use a nummer. so you select the parameter as a integer. or a long integer. When your finish defining the parameter. you can place this line under a commandbutton or whatever.
Code:
DataEnvironment1.Command1 Int("12345")
You have to make for every SQL statement a new command.
-Kayoca Mortation