RE: [Axapta-Knowledge-Village] Error in Connecting to Another Database
A quick note: i wrote my code in SalesFormLetter Class and i caled from SalesFormLetter_PickingList. The below try catch block will need to be at a place where ttslevel = 0 Regards harry From: Axapta-Knowledge-Village@yahoogroups.com [mailto:axapta-knowledge-vill...@yahoogroups.com] On Behalf Of Ashish Singh Sent: Saturday, September 04, 2010 10:44 AM To: Axapta-Knowledge-Village@yahoogroups.com Subject: Re: [Axapta-Knowledge-Village] Error in Connecting to Another Database Hi Sai Sharan, You can see the code in the standard DAX 2009 classes for your reference \Classes\SIGSigningProvider_SQLServer_Server Couple of suggestions for you, try to incorporate them. a) Try to incroporate the Permission class. b) Use the CCADO classes rather than ODBC classes for connecting to the another database. c) Be careful when supplying the login user name, make sure that the user name that you are using to connect to other system should not be used more than once. d) Put the code inside the Try Catch statement, else you will not be able to figure out as to why some error had happened at least that is the case for the CCADO classes. This is the sample code that i have posted from you. Here you can see that i written the code inside the try catch block and see the last part where i had done the exception handling this will give you detailed error message as to why error is popping up. This code is consuming the CCADO classes. void openConnection() { System.Exception clrException; InteropPermissionpermission = new InteropPermission(InteropKind::ClrInterop); Str localConnectionString; ; try { permission.assert(); // BP deviation documented sqlConnection = new System.Data.SqlClient.SqlConnection(sqlConnectionString); if(sqlConnection.get_State() != System.Data.ConnectionState::Open) { sqlConnection.Open(); } else { info("Connection is already open !"); } CodeAccessPermission::revertAssert(); } catch(Exception::CLRError) { // BP deviation documented clrException = CLRInterop::getLastException(); if (clrException != null) { clrException = clrException.get_InnerException(); if (clrException != null) { //store error - don't throw here throw error(clrException.get_Message()); } } } } Hope this will help you. Have a nice day. Regards, ashish singh < accenture On Sat, Sep 4, 2010 at 6:30 PM, Sai Sharan mailto:saisharan@gmail.com>> wrote: Hi all, i had a senario where i need to save some data from Ax_Database to another database. I had Written a code for connecting to the Externa database. It worked fine when i Executed my code in VPC(VirtualPC)., But when i Execute the same code in Client System it showed me a Problem saying that 1.ODBC operation failed.Unable to log on to the database. 2.[Microsoft][SQL Native Client]Login timeout expired. 3.Object 'OdbcConnection' could not be created. i wrote my code in SalesFormLetter Class and i caled from SalesFormLetter_PickingList. waiting fr ur valuable sugessions
Re: [Axapta-Knowledge-Village] Error in Connecting to Another Database
Hi Sai Sharan, You can see the code in the standard DAX 2009 classes for your reference * \Classes\SIGSigningProvider_SQLServer_Server* Couple of suggestions for you, try to incorporate them. a) Try to incroporate the Permission class. b) Use the CCADO classes rather than ODBC classes for connecting to the another database. c) Be careful when supplying the login user name, make sure that the user name that you are using to connect to other system should not be used more than once. d) Put the code inside the Try Catch statement, else you will not be able to figure out as to why some error had happened at least that is the case for the CCADO classes. This is the sample code that i have posted from you. Here you can see that i written the code inside the try catch block and see the last part where i had done the exception handling this will give you detailed error message as to why error is popping up. This code is consuming the CCADO classes. void openConnection() { System.Exception clrException; InteropPermissionpermission = new InteropPermission(InteropKind::ClrInterop); Str localConnectionString; ; try { permission.assert(); // BP deviation documented sqlConnection = new System.Data.SqlClient.SqlConnection(sqlConnectionString); if(sqlConnection.get_State() != System.Data.ConnectionState::Open) { sqlConnection.Open(); } else { info("Connection is already open !"); } CodeAccessPermission::revertAssert(); } catch(Exception::CLRError) { // BP deviation documented clrException = CLRInterop::getLastException(); if (clrException != null) { clrException = clrException.get_InnerException(); if (clrException != null) { //store error - don't throw here throw error(clrException.get_Message()); } } } } Hope this will help you. Have a nice day. Regards, ashish singh *<* *accenture* On Sat, Sep 4, 2010 at 6:30 PM, Sai Sharan wrote: > > > Hi all, > i had a senario where i need to save some data from Ax_Database to another > database. I had Written a code for connecting to the Externa database. > It worked fine when i Executed my code in VPC(VirtualPC)., But when i > Execute the same code in Client System it showed me a Problem > saying that > 1.ODBC operation failed.Unable to log on to the database. > 2.[Microsoft][SQL Native Client]Login timeout expired. > 3.Object 'OdbcConnection' could not be created. > > i wrote my code in SalesFormLetter Class and i caled from > SalesFormLetter_PickingList. > > waiting fr ur valuable sugessions > > >
[Axapta-Knowledge-Village] Error in Connecting to Another Database
Hi all, i had a senario where i need to save some data from Ax_Database to another database. I had Written a code for connecting to the Externa database. It worked fine when i Executed my code in VPC(VirtualPC)., But when i Execute the same code in Client System it showed me a Problem saying that 1.ODBC operation failed.Unable to log on to the database. 2.[Microsoft][SQL Native Client]Login timeout expired. 3.Object 'OdbcConnection' could not be created. i wrote my code in SalesFormLetter Class and i caled from SalesFormLetter_PickingList. waiting fr ur valuable sugessions
[Axapta-Knowledge-Village] Re: Error when duplicating code
I got solution for the problem. I deleted Usage data in tools-->Options,then it worked. "copy the customization from one company to other" means, I did some customization for a company, and i copy & pasted the same code for another company. It worked fine for first company but not for second company. But, after resetting Usage Data, it worked fine for second company also. Thank you for your reply. --- In Axapta-Knowledge-Village@yahoogroups.com, Diwakar Reddy Atchi wrote: > > Hey Bala > Â > I didnât get what you meant by "copy the customization from one company to > other"; can you please elaborate the problem? > If you trying to post a packing slip through X++ code, could you paste your > code > here? Also explain what you want to achieve. > Â > Thanks! > > > > > > From: bala_chivukula > To: Axapta-Knowledge-Village@yahoogroups.com > Sent: Tue, 31 August, 2010 5:29:22 AM > Subject: [Axapta-Knowledge-Village] Error when duplicating code > > Â > > Am getting this error when am trying to copy the customization from one > company > to other. i can able to create packing slip in original company but am > getting > this error when am trying to create it in dulicated company. > > Cannot create a record in Sales order - Update (SalesParmUpdate). > Insert operations are not allowed across companies. Please use changecompany > keyword to change the current company before inserting the record. > > Please help me... >