[Openroad-users] A little ADO help will be highly apreciated

Bloomfield, Martin (PSD) Martin.Bloomfield at psd.defra.gsi.gov.uk
Tue Mar 11 23:04:55 EST 2008


Kim,

 

I've not coded using SQL Server so might be wrong, but I seem to remember that in Visual Basic you had to do a RecordSet.MoveLast() followed by RecordSet.MoveFirst() to get the number of records populated.  I seem to remember that the recordset only gets populated with data when you try to access the individual records.

Martin Bloomfield. 
_________________________________________________ 
Application Developer & Database Administrator 
IT Branch, 
Pesticides Safety Directorate 
YORK 

Email: martin.bloomfield at psd.defra.gsi.gov.uk <mailto:martin.bloomfield at psd.defra.gsi.gov.uk>  
Website: www.pesticides.gov.uk <http://www.pesticides.gov.uk/>  

P Save a tree... please don't print this e-mail unless you really need to 

 

From: openroad-users-bounces at peerlessit.com [mailto:openroad-users-bounces at peerlessit.com] On Behalf Of Kim Ginnerup
Sent: Tuesday, March 11, 2008 11:55 AM
To: International OpenROAD Users
Subject: [Openroad-users] A little ADO help will be highly apreciated

 

Hi all,

 

I need to take some date out of an SQL Server 2005 and put them into an Ingres database.

The existing system is experiencing severe performance problems so what else to do but moving it to Ingres. ;-)

 

I could use a little help on the code below.

Recordset.Recordcount() returns -1; no matter what I do

Recordset.state() returns 1

 

 

initialize()=

declare

            con = MSADO!connection default null;

            rec = MSADO!_recordset default null;

            err = MSADO!errors default null;

            sel = varchar(2000);

            res = varchar(2000);

            i = integer not null;

            cnt = integer not null;

            state = integer not null;

            connectString = varchar(2000) not null;

enddeclare

{

            curframe.trace('start');

            curframe.flush();

 

            con = MSADO!connection(MSADO!connection.new());

            rec = MSADO!_recordset(MSADO!_recordset.new());

 

            connectString = 

                        'Provider=sqloledb;' + 

                        'Network Library=DBMSSOCN;' +

                        'Data Source=172.16.2.40,1433;' +

                        'Initial Catalog=VIS_xxxx;' +

                        'User Id=sa;' +

                        'Password=xxxxxxx';

            con.open(connectString);

            // sel = 'SELECT TOP 10 kunde FROM dbo.KUND_Reklamation';

            sel = 'SELECT GETDATE()';

            rec = con.execute(sel,,);

 

            // message con.errors().item.description;

            cnt   = rec.recordcount();

            state = rec.state();

            curframe.trace(varchar(cnt) +' rows found. Recordset.state: ' + varchar(state));

 

            for i = 0 to cnt -1 do

                        res = rec.fields.item(i).value;

                        curframe.trace(varchar(i) +': ' + res);

            endfor;

 

            rec.close();

            con.close();

                        

            rec = NULL;

            con = NULL;

}

 

Venligst,/Regards,

 

Kim Ginnerup
Technical Manager 

Bording Data A/S
Bredskifte Allé 11
DK-8210  Århus V
________________________
Tlf.:             4324 5424
Direkte tlf.  4324 5370
Fax:            8624 8626 

Mail: kgi at bording.dk <mailto:kgi at bording.dk> 
web: http://www.bordingdata.dk/ <http://www.bordingdata.dk/> 

________________________________________________________________________

Til Deres information:
Med henblik på at dokumentere kommunikationen mellem Bording Data og kunder/partnere, foretages automatisk journalisering af ind- og udgående mails på firma/kontaktperson niveau.

For Your information:
In order to ensure documentation of communication between Bording Data and our customers/partners, in- and outgoing emails are journalized at company/contact level . 

 

Department for Environment, Food and Rural Affairs (Defra)

This email and any attachments is intended for the named recipient only.
If you have received it in error you have no authority to use, disclose,
store or copy any of its contents and you should destroy it and inform
the sender.
Whilst this email and associated attachments will have been checked
for known viruses whilst within Defra systems we can accept no
responsibility once it has left our systems.
Communications on Defra's computer systems may be monitored and/or
recorded to secure the effective operation of the system and for other
lawful purposes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.peerlessit.com/pipermail/openroad-users/attachments/20080311/57a70cc0/attachment.html 


More information about the Openroad-users mailing list