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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Communicationg with COM through ASP 1

Status
Not open for further replies.

xterra

Programmer
Apr 5, 2001
71
US
I am a newbie at ASP so I may be doing something wrong. I have a DLL that I wrote in VB, that works perfect when I call it from VB but when I am using ASP to call the method, the webpage just sits there, it looks like it is doing something but the loading bar gets about half way and just stops, and nothing ever loads. I am Creating my Object in the global.asa like this

<OBJECT RUNAT=Server SCOPE=Session ID=objUsrName PROGID=&quot;SWImaging.clsUsrName&quot;></OBJECT>
<OBJECT RUNAT=Server SCOPE=Session ID=objBusName PROGID=&quot;SWImaging.clsBusName&quot;></OBJECT>

then making a search call to my user object, and passing it parameters of a recordset and the business object. Anybody know how I can see if maybe something is going wrong in my DLL by stepping through it or something?

Thank you,

Adam
 
First bit of advice is to not set an object with session scope. They tend to eat up a bunch of memory, and tend to hang around even after the user closes their browser. On a high traffic site, this can bring a server to its knees.

On to instantiating your object. Try this syntax:

dim objUserName
set objUserName = server.createObject(&quot;SWImaging.clsUsrName&quot;)

and then be sure to clean up once you're done like so:

set objUserName = nothing

For your session scope (carefully examine the real need for session scope before you do it), you can set a session object like so:

set session(&quot;objUserName&quot;) = objUserName

cleaning up like:

set session(&quot;objUserName&quot;) = nothing

hope that helps! :)
paul
penny1.gif
penny1.gif
 
Hey,

That works as far as making is just sit there, THANK YOU SO MUCH. Now it is giving me a Type Mismatch, but I assume that is because all ASP data types are variant, I will go into my component and change all the parameters to variant and see if that works. I will let you know when I get my first ASP script working :)

Thanks again,

Adam
 
Hey if u are passing parameters with &quot;ByRef&quot; then u should declare them as variant in the component but if u are pasing the data with &quot;ByVal&quot; then u can declare the datatype for that variable.

hope it helps...

srinu...
 
Ok Here is what I have figured out, After I did all the stuff I was still having the problem, with the page just sitting there. After much testing, I figured out with the problem is. I am getting my connectionstring from the registry by the Getsetting function in VB. Well it doens't seem to want to work for some reason. that is not what is causing the problem, though, the problem is that my user object displays a messagebox with the error information. The msgbox function is causing the browser to just sit there. I can take out the msgbox and it doesn't sit there, but now I need a way to get my connection information from a cental data source. I have two choices, If there is a way to make this registry work, then that would be my best choice; otherwise I am going to have to store the connection string somewhere else, like a text file or something. Any suggestions?

Thanks,

Adam
 
Well don't store it in a text file... unless that txt file is in some secure position on your server (outside the virtual directories of your website, and therefore unreachable through your website)... in that case, it would be ok, and the COM object could just connect to it using the fileSystemObject to get it's information.

If you don't do that, then you could just have the connection string as property of your object, and pass it in whenever you need to use it (much like the ADODB.Connection object does). This would make the component much more portable, as any user anywhere could use it to connect to any database with no need to make a txt file in a certain place so that the component could read from it.

If I had my druthers, I'd opt for the second option... but either way would work.

:)
paul
penny1.gif
penny1.gif
 
Thanks, Paul that is what I'm going to do (the second option). Thanks for all your help.

Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top