Results 1 to 3 of 3

Thread: Syntax Error Passing SQL to DataEnvironment

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Location
    Buffalo,NY
    Posts
    8

    Post

    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?

  2. #2
    Addicted Member
    Join Date
    Oct 1999
    Posts
    253
    I suggest using RecordSet objects instead of Command objects. Then you can change the query sentence without any problems.

  3. #3
    Guest
    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width