SQL 2000 Support

Jul 1, 2009 at 6:40 PM

Started a new thread for this.

The new build did resolve the issue in New-DataModelAssembly.  I now recieved "New-Object Contructor not found.  Cannot find appropriate constructure for type DB.MainDataContext."


New-DataModelAssembly $sqlConnection "DBModel" $assemblyParentPath "DB"
$ctx = New-Object "DB.MainDataContext" $sqlConnection



Jul 2, 2009 at 4:58 PM

Here's a very simple working example, similar to yours (conn string needs to be changed of course). 


add-pssnapin AlexPilotti.PowerQuery

$connStr = "Data Source=servername;User ID=xxxx;Password=xxxx;Initial Catalog=Northwind"

New-DataModelAssembly $connStr "test" $Env:Temp "DB"

$ctx = New-Object "DB.MainDataContext" $connStr

If New-Object is not able to find the class, could you please run
To check that the generated assembly is correctly loaded?
In order to replicate your issue, it might be useful if you could send me privately:
  • A copy of the dll generated by New-DataModelAssembly
  • A copy of your database DDL (if possible).
Jul 13, 2009 at 5:11 PM

Working based off the the code you provided.  Could you explain what the "test" and "DB" string paramaters are for?

Jul 14, 2009 at 6:24 PM


in the preceeding sample code, 

"test", is the name of the assembly (you will find a freshly generated dll named test.dll in your %TEMP% folder)

"DB" is the root namespace of the classes in your generated assembly, thus "DB.MainDataContext" is the DataContext class to create with new-object.

You can of course change them to any value meaningful for you. Please ensure that the third parameter in New-DataModelAssembly points to an existing folder where the code has write permissions (e.g.: your temp folder).