I am getting an error -- "InvalidCastException: QueryInterface for interface" -- when I call it in my ASPx page. But it works fine when I call it in VB6, and I have a DLL created using VB6. When I call the same in a .NET application, it gives me System.InvalidCastException:QueryInterface for interface Projectname.ClassName failed. I have registered the DLL in all the boxes. In ASP, I call the function like this:
"Set objIsam = server.CreateObject("NBPIsamFileAccess.ReadRecord") With objIsam .UserType = "TYPE" .UserID = "ID" .UserDomain = "DOMAIN" .PdcrState = "" .PdcrCode = "" End With blnOK = objIsam.ReadCIACCTT0("04202","C","Smith","",objRst1)"
It worked fine. I used the same DLL in ASPx page, but it is not working. In the ASPx page, I first added reference to the project, from select/project then COM tab, then I selected the corresponding DLL and created the runtime callable wrapper using .NET SDK environment. Then I used it like this in the ASPx:
When I ran it, I got above error at line .UserType = "TYPE" in the beginning of With statement. Please advise me. Thanks.
You're not doing a New() on the class for the myNBPIsam variable. That could be the problem.
Dig Deeper on ASP.NET and Ajax development
Related Q&A from Daniel Cazzulino
Here Daniel Cazzulino explains how to load a DSL (domain specific language) domain model instance file programmatically. This requires the .NET type ... Continue Reading
Here we offer a glimpse at 12 of .NET development expert Danny Cazzulino's top ASP.NET questions and answers. Continue Reading
C# developers should NOT be modifying InitializeComponent method in the code-behind (or any of the variable definitions) by hand. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.