The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Database conection problem

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
peter.cook Posted - 01/11/2006 : 2:16:44 PM
Origin Version (Select Help-->About Origin): 7.5 SR7
Operating System: Win2000

Hi,

I have the same code for 2 opj files that connects to a database and pastes the data into a worksheet.
ie the code and sql statement are correct.
For 1 oj it works fine but for the other I get
'Error : 284'

Any help /suggestions would be appreciated!

Cheers,

Pete

5   L A T E S T    R E P L I E S    (Newest First)
ML Posted - 01/12/2006 : 7:17:16 PM
Hi Peter,

It appears that the error is coming from a failed automation call to the Recordset object. The object (i.e. the server) may provide a more detailed textual information about the failure. But since the call is inside a try-catch block, there is no run-time error, and, thus, no (possible) additional textual information is displayed.

Can you, therefore, remove the try-catch. In this case when the failure occurs, Origin C execution will stop, and you may see more text dumped to the output (Script Window or elsewhere). If so, please, post the text here.

Thanks.

ML

peter.cook Posted - 01/12/2006 : 12:46:01 PM
Hi again,

The message box in the catch script outputs 'Could not connect to database' and the code falls down at the 'ocrs.open(SQLString...' line as per the try statement.

The error code or value of ErrorCode is 284.

Cheers,

Pete

ML Posted - 01/12/2006 : 12:28:38 PM
When the error occurs (either a message box or in Script window), can you, please, make a screen grab of that portion of the screen where you see the error displayed, and post it here?

Thanks.

ML
peter.cook Posted - 01/12/2006 : 09:16:27 AM
Hi Marko,

The offending code was :

 void OCQuery_ATP_levels()
{
Object ocrs;
string SQLString;
SQLString = "select d1.ID, d1.KINASE_SYMBOL, d1.KINASE_NAME, d1.ATP_LEVEL from pete_assays d1, pete_assay_panel d2 where d1.ID = d2.ASSAY_ID and d2.current_process_quarter_panel = 'Y' ORDER BY d1.ID";
ocrs = CreateObject("ADODB.Recordset");
try {
ocrs.open(SQLString, "Provider=msdaora; Data Source=RES1; User ID=UserID; Password=Password;");
};
catch (int ErrorCode) {
MessageBox(GetWindow(),"Could not connect to database");
return;
};
Worksheet wks("ATPlevels");
// Put the recordset into worksheet:
BOOL bRet = wks.PutRecordset(ocrs, 0, -1, 0, LAYWKGETRECORDSET_BY_COLUMN_INDEX);
//out_int("bRet = ", bRet);

}


However, both apps were working today! It is possible that I have lost track of which was the correct app version but in the event that this occurs again any info re error code or other insight would be useful. Thanks,

Update : Happened again but not on another PC ..

Cheers,

Pete



Edited by - peter.cook on 01/12/2006 10:33:43 AM
ML Posted - 01/11/2006 : 3:18:24 PM
Hi Peter,

Where do you see the error 'Error : 284'? Message box or Script Window? Also, are you running OC code when the error appears, and, if so, at which line of OC code (you can debug line-by-line to find that out) do you see the error (perhaps you could paste the OC code, or part thereof, which you use for accessing db and putting values into worksheets)?

Thanks.

ML


Edited by - ML on 01/11/2006 3:19:53 PM

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000