|
From: T McDonald on 18 Mar 2008 10:43 I'm having some issues with a dll I've created to return an ADOConnection back to an ASP script. I successfully open my object: mytest = Server.CreateObject("mydll.database") I then attempt to use the connection: myConnection = mytest.getConnection This is where the script breaks down with an "Object required" error. I am able to access other methods in the dll, it just doesn't seem to be returning the database connnection successfully. Any help is greatly appreciated.
From: Bob Barrows [MVP] on 18 Mar 2008 10:56 T McDonald wrote: > I'm having some issues with a dll I've created to return an > ADOConnection back to an ASP script. > > I successfully open my object: > mytest = Server.CreateObject("mydll.database") > I then attempt to use the connection: > myConnection = mytest.getConnection Does getConnection return an object? If so, you cannot assign an object to a variable without using the Set keyword: Set myConnection = mytest.getConnection > > This is where the script breaks down with an "Object required" error. I suspect this error occurs on subsequent lines where you attempt to use the connection object, right? > > I am able to access other methods in the dll, it just doesn't seem to > be returning the database connnection successfully. > > Any help is greatly appreciated. Marshalling COM objects across processes is always problematic. My suggestion would be to do all database work within the dll (making it a true "database layer") instead of doing some in the dll and some in ASP. If you absolutely must do some database work in ASP, then I would suggest retrieving a connection string from the dll instead of the object itself. There really is no benefit to passing the object vs. passing a string and opening your own connection object. -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
From: T McDonald on 18 Mar 2008 11:28 "Bob Barrows [MVP]" wrote: > T McDonald wrote: > > I'm having some issues with a dll I've created to return an > > ADOConnection back to an ASP script. > > > > I successfully open my object: > > mytest = Server.CreateObject("mydll.database") > > I then attempt to use the connection: > > myConnection = mytest.getConnection > > Does getConnection return an object? If so, you cannot assign an object to a > variable without using the Set keyword: > > Set myConnection = mytest.getConnection > > > > > This is where the script breaks down with an "Object required" error. > > I suspect this error occurs on subsequent lines where you attempt to use the > connection object, right? Yes, this is exactly the issue. It didn't dawn on me that I needed to use set. That clears up more than one bit of confusion. > > I am able to access other methods in the dll, it just doesn't seem to > > be returning the database connnection successfully. > > > > Any help is greatly appreciated. > > Marshalling COM objects across processes is always problematic. My > suggestion would be to do all database work within the dll (making it a true > "database layer") instead of doing some in the dll and some in ASP. If you > absolutely must do some database work in ASP, then I would suggest > retrieving a connection string from the dll instead of the object itself. > There really is no benefit to passing the object vs. passing a string and > opening your own connection object. I would prefer to do all the database connections, and collection of data within the ddl, however, once I have the recordset, I have to pick particular items out of the data - which I don't (or can't realistically at this point) want to manipulate wthin the dll. Unless I am looking at this completely wrong - are you suggesting to return the recordset? Thanks for the help. > -- > Microsoft MVP - ASP/ASP.NET > Please reply to the newsgroup. This email account is my spam trap so I > don't check it very often. If you must reply off-line, then remove the > "NO SPAM" > > >
From: Bob Barrows [MVP] on 18 Mar 2008 11:42 T McDonald wrote: > "Bob Barrows [MVP]" wrote: >> Marshalling COM objects across processes is always problematic. My >> suggestion would be to do all database work within the dll (making >> it a true "database layer") instead of doing some in the dll and >> some in ASP. If you absolutely must do some database work in ASP, >> then I would suggest retrieving a connection string from the dll >> instead of the object itself. There really is no benefit to passing >> the object vs. passing a string and opening your own connection >> object. > > I would prefer to do all the database connections, and collection of > data within the ddl, however, once I have the recordset, I have to > pick particular items out of the data - which I don't (or can't > realistically at this point) want to manipulate wthin the dll. Unless > I am looking at this completely wrong - are you suggesting to return > the recordset? > I actually wasn't but yes, I would prefer passing a disconnected recordset back and forth, especially if an xml document created by using the recordset's Save method is passed. The idea is to open a client-side recordset using the adLockUpdateBatch LockType, disconnect it by setting its activeconnection property to Nothing, use Save to persist it as an xml document (rs.Save xmldoc) which you pass to the caller. The caller can use it to open its own recordset (rs.open xmldoc), do what needs to be done to it, then save it back to xml and pass it to the dll to be processed. -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
From: B on 28 Mar 2008 08:42 How about simply adding SET to your stmt(s) (so that they get created as objects): SET mytest = Server.CreateObject("mydll.database") ..... SET myConnection = mytest.getConnection "T McDonald" wrote: > I'm having some issues with a dll I've created to return an ADOConnection > back to an ASP script. > > I successfully open my object: > mytest = Server.CreateObject("mydll.database") > I then attempt to use the connection: > myConnection = mytest.getConnection > > This is where the script breaks down with an "Object required" error. > > I am able to access other methods in the dll, it just doesn't seem to be > returning the database connnection successfully. > > Any help is greatly appreciated. >
|
Next
|
Last
Pages: 1 2 3 Prev: Exception when sending mail Next: How to setup a HTTP Server in the PC |