Asp vb com component development and debugging

Source: Internet
Author: User

Today, I checked an old asp program on the company server and found that I actually called the custom com component, which was written in vb and encapsulated database connections and operations, in this document, why can't users see the username and password of the database on the server? That's right. This is a financial server. Of course, we can't just read it! (It fooled finance to make finance believe that it cannot see the database username and password, my god) because our server administrator wants the server and decides to "Harmony" the server, only applications on this server can be moved to another server. Therefore, you need to change this com component to specify a New db name,

Copy the source code of the com component to the local machine, change the connection, compile the dll, and copy the source code to the server. regsvr32 is registered, and everything is normal. So I will call the original db offline, page error! Open the page to see the error message odbc does not find the database. Take a closer look, it is still the original database, the heart of the cold, immediately google, and the original db online

I had to restart iis: iisreset

 

Add a com component method,

Public Function getData (ByVal sss As Integer) 'as Variant cannot add the return value type <br/> Dim dd () 'As String cannot be added with the return value type <br/> Dim I as Integer <br/> ReDim dd (sss-1) <br/> I = 0 <br/> Do While I <sss <br/> dd (I) = CStr (I) <br/> I = I + 1 <br/> Loop <br/> getData = dd </p> <p> End Function<% <Br/> dim B <br/> B = com. getData (10) <br/> Response. write VarType (B) & "ssss" <br/> Response. write B (1) <br/> %>

The array and return values cannot be of the specified type. Otherwise, VarType returns 8200, prompting "Type mismatch" error. The normal value is 8204.

 

During the first compilation, project properties-parts-version compatibility-incompatible, select project compatibility when compiling

 

During the com component re-compilation, the local iis: iisreset/stop must be set to ensure that no process calls this component; otherwise, the original dll cannot be overwritten.

 

This is the method for asp to return values from the com Component Array.

 

Sleepy, sleeping ^_^

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.