I'm trying upgrade an existing VB6 project that uses the SQLDMO object
library, and I'm having a problem with a specific method. While this is
a very specific error, I think it may be a broader problem than just
this one error.
SQLDMO Method definition (COM objects from VB6)
Script([ScriptType As SQLDMO_SCRIPT_TYPE =3D SQLDMOScript_Default],
[ScriptFilePath], [Script2Type As SQLDMO_SCRIPT2_TYPE =3D
SQLDMOScript2_Default]) As String
Iterop.SQLDMO definition (COM wrapper as created by VB.NET)
Script(Optional ByVal ScriptType As SQLDMO.SQLDMO_SCRIPT_TYPE =3D
37852723347250747801600, Optional ByVal ScriptFilePath As Object,
Optional ByVal Script2Type As SQLDMO.SQLDMO_SCRIPT2_TYPE =3D
4796154026512550723584) As String
VB6 Code... (works with no problems)
Dim lxSV as SQLDMO.SQLServer2
Dim lxDB as SQLDMO.Database2
dim lsScript as string
Set lxSV =3D New SQLDMO.SQLServer2
lxSV.Connect "Server", "sa", "sa"
Set lxDB =3D lxSV.Databases.Item("Database")
lsScript =3D lxDB.Defaults.Item(i).Script(, , SQLDMOScript2_70Only)
VB.NET Code...(does not work)
Dim lxSV as SQLDMO.SQLServer2
Dim lxDB as SQLDMO.Database2
dim lsScript as string
lxSV =3D New SQLDMO.SQLServer2()
lxSV.Connect("Server", "sa", "sa")
lxDB =3D lxSV.Databases.Item("Database")
lsScript =3D lxDatabase.Defaults.Item(i).Script(, ,
SQLDMO.SQLDMO_SCRIPT2_TYPE.SQLDMOScript2_70Only)
The .NET call to the Script method returns a COM exception error stating
that the arguments of the method must be of type Integer, String or
Object. Additional attempts to put the default values into the method
call also failed. I think the problem is with the 2nd argument:
ScriptFilePath as Object. I think the .NET wrapper should have made it
a string.
Anybody have any ideas?
Thanks,
Steve Brownell, MCP
AllMeds, Inc.