FoxPro and .NET Interop
OLE Dispatch exception code () from wwDotNetBridge: Method not found '0||System.Array.Empty()"...
Gravatar is a globally recognized avatar based on your email address. OLE Dispatch exception code () from wwDotNetBridge: Method not found '0||System.Array.Empty()"...
  Victor Anderson
  All
  Oct 22, 2024 @ 03:22pm

I am trying to use the sqlbulkcopy.dll to copy files from VFP to SQL Server. Had everything working fine..BUT servers were lost and now we have new servers and I'm having ot redo everything and I can't get it to work anymore.

This is the error I get: rror message: OLE Dispatch exception code () from wwDotNetBridge: Method not found '0||System.Array.Empty()"... Error number 1429 Procdure with error: WWDONTNETBRIDGE.CREATEINSTANCE Line number with error: 295

The offending line of VFP code seems to be this:

loBulkCopy = loBridge.CreateInstance('SQLBulkCopy.SQLBulkCopy')

Do you have any ideas on how I can fix this? It works fine from my desktop PC, but fails on the server grrrrr.

Thanks!

Gravatar is a globally recognized avatar based on your email address. re: OLE Dispatch exception code () from wwDotNetBridge: Method not found '0||System.Array.Empty()"...
  Rick Strahl
  Victor Anderson
  Oct 22, 2024 @ 04:47pm

You might want to check the versions of the DLLs. It's possible there are new DLLs and they have different signatures for the class...

Also make sure that your wwDotnetBridge version is matches (PRG/DLL).

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: OLE Dispatch exception code () from wwDotNetBridge: Method not found '0||System.Array.Empty()"...
  Victor Anderson
  Rick Strahl
  Oct 22, 2024 @ 04:58pm

I think the only .dll's in use are: clrhost.dll sqlbulkcopy.dll wwdotnetbridge.dll

..and those are the same between machines. I will double check this though. Perhaps there are other .dll's that it uses I need to check?? I will check the .prg too. It all seems odd as it works on one machine and not the other,.. and I copied all the .dlls from the working machine. I'm sure it's something simple that I've missed or messed up lol lol. Perhaps missing a .net runtime? I have a bunch of them installed on the working machine, but I think only 6 and 7 on the non-working one.

Thanks for helping 😃

Gravatar is a globally recognized avatar based on your email address. re: OLE Dispatch exception code () from wwDotNetBridge: Method not found '0||System.Array.Empty()"...
  Rick Strahl
  Victor Anderson
  Oct 23, 2024 @ 11:02am

Are you talking about this class?

If so, you don't need any dependencies (no extra DLL is needed) as it's a built-in function in the framework in System.Data.SqlClient.

This code works for me to instantiate:

do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = GetwwDotnetBridge()

lcConn = "server=.;database=WebStore;integrated security=true; encrypt=false"
loConn = loBridge.CreateInstance("System.Data.SqlClient.SqlBulkCopy",lcConn)
? loBridge.cErrorMsg

loConn.BatchSize = 20
? loConn.BatchSize

+++ Rick ---

© 1996-2024