Invoking ADO.NET from MATLAB

Posted by Andrew Shepherd on Stack Overflow See other posts from Stack Overflow or by Andrew Shepherd
Published on 2010-03-22T06:49:44Z Indexed on 2010/03/22 6:51 UTC
Read the original article Hit count: 509

Filed under:
|

It's possible to call .NET from MATLAB, so I thought I would try to use ADO.NET to connect to a database.

I seem to have hit a blocking problem - anytime you try and create a Command object, it throws an error.

You can try this yourself:

>> NET.addAssembly('System.Data');
>> sqlconn = System.Data.SqlClient.SqlConnection();
>> sqlconn.State

ans = 

    Closed    

>> % So far, so good
>> sqlcmd = System.Data.SqlClient.SqlCommand();
??? Error using ==> System.Data.SqlClient.SqlCommand
'Connection' is already defined as a property.

>> 

Does anyone have some insight into this? It seems like a pure and simple bug on MATLAB's part - maybe it happens with every .NET class that happens to have a property called "Connection".

Should I just throw in the towel and give up on using MATLAB to talk to a database using .NET?

© Stack Overflow or respective owner

Related posts about matlab

Related posts about ADO.NET