-
Aug 18th, 2022, 10:35 PM
#1
Thread Starter
New Member
[RESOLVED] RC6 cConnection.CreateTableFromADORs with ASP
Hello,
I´m trying to use RC6 CreateTableFromADORs in a very simple page, reading from a SQLServer 2019 database, but always get a Type Mismatch error:
Code:
set aConn = Server.CreateObject("ADODB.Connection")
set rConn = Server.CreateObject("RC6.cConnection")
aConn.open "Provider=SQLNCLI11;Server=localhost;Database=xxx;Uid=xxx;Pwd=xxx"
rConn.OpenDB("E:\mysqlite.db3")
rConn.CreateTableFromADORs rConn, "table2", aConn.execute("Select * From table1")
The error message is:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'rConn.CreateTableFromADORs'
/testcreate.asp, line 8
What am I missing here?
Last edited by beltrao73; Aug 19th, 2022 at 10:43 AM.
-
Aug 19th, 2022, 06:16 AM
#2
Thread Starter
New Member
Re: RC6.cConnection.CreateTableFromADORs with ASP
These are the Recorset properties:
IAccessor : True
IColumnsInfo : True
IColumnsRowset : True
IConnectionPointContainer : True
IConvertType : True
IDBAsynchStatus : False
IGetSession : False
IMultipleResults : True
IRow : False
IRowset : True
IRowsetChange : False
IRowsetFind : True
IRowsetIdentity : True
IRowsetInfo : True
IRowsetLocate : False
IRowsetRefresh : False
IRowsetResynch : False
IRowsetScroll : False
IRowsetUpdate : False
ISupportErrorInfo : True
ISequentialStream : True
Preserve on Abort : False
Access Order : 2
Blocking Storage Objects : True
Bookmark Information : 0
Use Bookmarks : False
Skip Deleted Bookmarks : False
Bookmark Type : 1
Fetch Backwards : False
Hold Rows : False
Scroll Backwards : False
Change Inserted Rows : False
Column Privileges : True
Command Time Out : 30
Preserve on Commit : False
Defer Column : False
Delay Storage Object Updates : False
Find Operations : 61
Hidden Columns : 0
Immobile Rows : True
Literal Bookmarks : False
Literal Row Identity : True
Lock Mode : 1
Maximum Open Rows : 0
Maximum Pending Rows : 0
Maximum Rows : 0
Notification Granularity : 1
Notification Phases : 31
Column Set Notification : 3
Row Delete Notification : 3
Row First Change Notification : 3
Row Insert Notification : 3
Row Resynchronization Notification : 3
Rowset Release Notification : 3
Rowset Fetch Position Change Notification : 3
Row Undo Change Notification : 3
Row Undo Delete Notification : 3
Row Undo Insert Notification : 3
Row Update Notification : 3
Others' Inserts Visible : False
Others' Changes Visible : False
Own Inserts Visible : False
Own Changes Visible : False
Quick Restart : False
Reentrant Events : True
Remove Deleted Rows : False
Report Multiple Changes : False
Return Pending Inserts : False
Row Privileges : True
Asynchronous Rowset Processing : 0
Row Threading Model : 1
Server Cursor : False
Server Data on Insert : False
Strong Row Identity : True
Objects Transacted : False
Unique Rows : False
Updatability : 0
Maximum BLOB Length : 0
Fastload Options :
Keep Nulls : False
Keep Identity : False
Cursor Auto Fetch : False
Defer Prepare : True
IRowsetFastLoad : False
Query Notification Timeout : 432000
Query Notification MsgText :
Query Notification Options :
ISSAsynchStatus : False
ColumnID :
NoCount : True
ComputeId : 0
ComputeByList : False
Bookmarkable : False
-
Aug 19th, 2022, 04:51 PM
#3
Thread Starter
New Member
Re: RC6 cConnection.CreateTableFromADORs with ASP
Same error happens with VB Script.
It seems to me that CreateTableFromADORs doesn´t recognize the Recordset Object the same way as in VB6.
-
Aug 19th, 2022, 10:26 PM
#4
Re: RC6 cConnection.CreateTableFromADORs with ASP
What is the CREATE TABLE schema of your SQLServer 2019 database "table1" table?
-
Aug 20th, 2022, 08:25 AM
#5
Re: RC6 cConnection.CreateTableFromADORs with ASP
Originally Posted by beltrao73
Same error happens with VB Script.
It seems to me that CreateTableFromADORs doesn´t recognize the Recordset Object the same way as in VB6.
VBScript often has difficulties passing Objects of certain types into COM-Methods...
- due to "working LateBound, holding concrete ObjTypes in Variant-Variables
- and when the COM-method in question has defined the ObjType-Param ByRef (which is the case with many RC-methods)
So, the "Type mismatch"-error comes, from trying to pass a Variant directly to a (ByRef) defined ClassType-argument.
This error can be avoided in two ways:
1) by re-defining the COM-Lib Method in question, using ByVal instead of ByRef before the ClassType-Param
..(which I'm not going to do)
2) by wrapping the passed ObjVariables in extra-parentheses at the VBScript-callsite
Code:
rConn.CreateTableFromADORs (rConn), "table2", (aConn.execute("Select * From table1"))
HTH
Olaf
-
Aug 22nd, 2022, 06:17 AM
#6
Thread Starter
New Member
Re: RC6 cConnection.CreateTableFromADORs with ASP
Hi Olaf,
The extra parentheses worked just fine. Thank you very much.
I´m impressed with the speed of this method. So useful for exporting purposes.
Originally Posted by Schmidt
2) by wrapping the passed ObjVariables in extra-parentheses at the VBScript-callsite
-
Aug 22nd, 2022, 04:51 PM
#7
Re: RC6 cConnection.CreateTableFromADORs with ASP
Originally Posted by beltrao73
I´m impressed with the speed of this method. So useful for exporting purposes.
Yep, it is no slouch...
We use it in some of our IIS-based WebApis, to dynamically convert (MS-SQLServer-derived) AdoRs into JSON-responses -
like in this little "asp-helper-routine":
Code:
Sub SendAdoRsAsJson(AdoRs)
With New_c.MemDB
.Cnn.CreateTableFromADORs (.Cnn), "T", (AdoRs)
Response.ContentType = "application/json"
Response.BinaryWrite .GetRs("Select * From T").ToJSONUTF8
End With
End Sub
Olaf
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|