Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PowerCOBOL with ADO Connection - write the first record in the table

Status
Not open for further replies.

projrev2

Programmer
Feb 26, 2009
3
0
0
BR
Hi,

I use PowerCOBOL v10.
I did a project using ADO datasource control to connect to an MS SQL table that this empty table does not contain any record.
I will write the first record in the table
I use addnew method

INVOKE "Recordset" OF CmADODataSource1 "AddNew"

INVOKE tnum_func "UpdateRecord"
INVOKE tnome_func "UpdateRecord"
INVOKE "Recordset" OF CmADODataSource1 "Update"



but not recording the first record in the table
shows error message that recordset is empty
a friend can show how to record the first record in the table
thank you

Paulo

 
put full code please and error message you are getting.

and also look at the examples on the faqs to see if you are missing some aspect of it

Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
Hi Frederico,

This is error message when INVOKE "Recordset" OF CmADODataSource1 "Update"
command is executed

Message is
an empty line can not be inserted
The line should have at least one defined value column.


Remember my this empty table, no records exist engraved on it.
this is the first record that I will write to the table.


error_message_ccbgd9.jpg



Regards

Paulo
 
I did ask for full source - where is the source for tnum_func and tnome_func? where is CmADODataSource1 defined and how is it defined?

and error is quite clear - the fields of the recordset are empty which means that the 2 functions you call between the AddNew and the Update did not do anything or did something that wasn't what you expected.

Assuming that your recordset contains the fields I see mentioned on your sample code are the fields of that recordset try the following

copy the 3 lines where you do a move of source, state and status to umsg and display each of the values to a line between the "invoke tnome_func .." and the "invoke recordset ... Update". I expect they will be empty as per the error message.

As a standard I would also advise you to explicitly define a recordset object and work with it instead of using the default(current) recordset of a connection.

Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
that's no good for me - at the moment I don't have powercobol available and the ppj in any case contains copybooks that weren't supplied.

so as you have to invoke statements with a updaterecord method give us the full source of those - copy and paste into notepad and only then put here as text.

and have you tried what I said?



Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top