Reputation: 21
i am currently creating my project in cobol2 .. i am using a visual cobol of microfocus and was used a Ado.net for my database.. On the interface of openesql assistant i can insert values in my database table.. but on the form of my project on the button1 clicked i've got an error saying "NO SQL DIRECTIVES HAVE BEEN SET"
(here is my code
method-id button1_Click final private.
procedure division using by value sender as object e as type System.EventArgs.
EXEC SQL
INSERT INTO NayreInventory
(ItemCode
,ItemDescription
,Quantity
,Price
) VALUES (
:NayreInventory-ItemCode:NayreInventory-ItemCode-0001
,:NayreInventory-ItemDescription:Col-2-MEDICOL
,:NayreInventory-Quantity:NayreInventory-Quantity-5
,:NayreInventory-Price:NayreInventory-Price-150
)
END-EXEC.
invoke type MessageBox::Show("1 RECORD HAS BEEN SUCCESSFULLY ADDED", "RESULT")
end method.
) how to get rid on the error.. please help me .. i really nid ur help..
Upvotes: 0
Views: 2676
Reputation: 5018
There are several ways to specify Micro Focus COBOL compiler directives. One way to specify your SQL/NOSQL directive is to embed the directive in your COBOL source, with the $
in column 7, like so:
$SET SQL
or, depending on your needs:
$SET NOSQL
You can also use the command line:
cob -C SQL ...source file name and other arguments
Follow the links for more details.
Upvotes: 1
Reputation: 13076
Do you have a message number as well, like this?
"0149 No SQL directives have been set"
The description of that message is:
"An EXEC SQL statement has been encountered but no SQL directive has been specified. The processing of the statement varies depending on whether the directive SQL is set or not; either SQL or NOSQL must be explicitly specified.
See Also: The SQL Compiler directive in the chapter Directives for Compiler in your Server Express User's Guide."
So it would look like you are missing a "compiler option" from your compile script.
This is from: http://supportline.microfocus.com/documentation/books/sx20books/emsynt.htm
To get the information I just googled your error message.
Upvotes: 1