hi there (my first post)
to quote TomRizzo in this thread:
i used the search function and found a lot of information, but i think i got a different TYPE MISMATCH error than all the previous posters, or i didn't found the right thread for my needs.Hi All, I know this problem has come up dozens of times, but I'm still stuck after days of mind-numbing surfing... drool.
solutions were always about data type variant in vbscript and parameters, but my problem seems to be something different.
anyway, let me post some code:
the asp type libary and the microsoft active data object library 2.5 have been included properly.Code:Public objResponse As ASPTypeLibrary.Response Public objApplication As ASPTypeLibrary.Application Public objSession As ASPTypeLibrary.Session Public rs As New ADODB.Recordset Public strConnectionString As String Public cn As New ADODB.Connection Public Sub OnStartPage(sc As ScriptingContext) Set objResponse = sc.Response Set objApplication = sc.Application Set objSession = sc.Session End Sub Public Sub ConnectToDB() strConnectionString = objApplication("CONNSTRING") cn.ConnectionString = strConnectionString cn.Open End Sub Public Sub DisconnectFromDB() cn.Close Set rs = Nothing Set cn = Nothing End Sub Public Sub WriteField(fname As String) objResponse.Write rs.Fields(fname) End Sub Public Sub CloseRS() rs.Close End Sub Public Sub ExecuteQuery(ByVal strSQLString As String) Dim cmd As New ADODB.Command cmd.ActiveConnection = cn cmd.CommandText = strSQLString cmd.CommandType = adCmdText Set rs = cmd.Execute Do While Not rs.EOF For Each Field In rs.Fields objResponse.Write rs(Field.Name) Next rs.MoveNext Loop CloseRS End Sub Public Sub testing() objResponse.Write "hell-O" rsIsOpen = False objResponse.Write "<br>rsisopen = " & rsIsOpen & "<br><br>" objResponse.Write "<br>" & objApplication("CONNSTRING") & "<br><br>" End Sub
here's the sample asp file:
now i'm getting this error:Code:dim mycontent set myCONTENT = Server.CreateObject("PPMDDDAK.CONTENT") mycontent.testing myCONTENT.ConnectToDB myCONTENT.ExecuteQuery "select * from myusers" Do While Not myCONTENT.EOF myContent.WriteField("UserName") & "<br>" myCONTENT.Movenext Loop myCONTENT.CloseRS myCONTENT.DisconnectFromDB set mycontent=nothing
(type mismatch error in line 6 as you see)PPMDDDAK-Fehler '800a000d'
Type mismatch
/ppmTest.asp, Zeile 6
line 6: myCONTENT.ExecuteQuery "select * from myusers"
so i made some output-testing in de executequery sub:
(looks weird but works)
output works until 5, then the type mismatch error occurs in this line: "set rs = cmd.execute"Code:Public Sub ExecuteQuery(ByVal strSQLString As String) objResponse.write "1<br>" Dim cmd As New ADODB.Command objResponse.write "2<br>" cmd.ActiveConnection = cn objResponse.write "3<br>" cmd.CommandText = strSQLString objResponse.write "4<br>" cmd.CommandType = adCmdText objResponse.write "5<br>" Set rs = cmd.Execute objResponse.write "6<br>" Do While Not rs.EOF objResponse.write "7<br>" For Each Field In rs.Fields objResponse.write "8<br>" objResponse.Write rs(Field.Name) objResponse.write "9<br>" Next objResponse.write "10<br>" rs.MoveNext objResponse.write "11<br>" Loop objResponse.write "12<br>" CloseRS objResponse.write "13<br>" End Sub
now the real problem is: tested as an exe project, everything worked fine. compiled to an activexdll it crashed with this error, but only on my nt 4 server (which i have to use), on the localhost with windows xp everything just worked fine, but not on the nt4 server (with option pack installed)
but why is this so? i'm totally stuck...
i've also tried it without parameters like this one:
but i also got the same type mismatch error.Code:Public Sub ExecuteQuery(ByVal strSQLString As String) Dim cmd As New ADODB.Command cmd.ActiveConnection = cn cmd.CommandText = "select * from sysobjects" cmd.CommandType = adCmdText Set rs = cmd.Execute Do While Not rs.EOF For Each Field In rs.Fields objResponse.Write rs(Field.Name) Next rs.MoveNext Loop CloseRS End Sub
where's the problem with the line "set rs = cmd.execute" ? i did it nearly a thousand times in an asp file and it worked on the nt4 server, but as soon as i do this with this dll i'm getting a type mismatch?
could you please check my whole source for errors? maybe it's just a declaration problem?
one more thing: i have to use this recordset global, cause as soon as i can fix this problem i have to build a whole lot of other stuff around this dll![]()
edit: i also tried to install the microsoft visual basic 6 runtime files on the nt4 server, but the error is still there...
maybe you've got a clue for me? something? anything? i'm really stuck and this whole project should have been finished some time ago![]()
a 1024 thanks in advance!![]()




)
Reply With Quote