Use nHydrate with SQLServer 2000

Dec 29, 2010 at 10:56 AM

After reading good reviews about your product I decided to give nHydrate a try. I tried to import our existing database into nHYdrate but I got the error "The connection information is invalid."

Try the find the problem I downloaded your sourcecode and found out that the problem was that I used SQLServer 2000 instead of SQLServer 2005 or above. In SQL2000 the database tables can be found with the query : 

SELECT * 
FROM dbo.sysobjects
WHERE xtype = 'u'
ORDER BY Name

in SQL2005 and above u need to use the query :

SELECT * 
FROM sys.tables 
ORDER BY Name;
GO

and that is the query that nHydrate is using. So problem solved :) I can just import my db in SQL2005 and import it into nHydrate. My question is:

If I use SQL2005 to import the model, can I then use the generated code to access a SQL2000 db (some of my customers can't switch to SQL2005 right now).

Or is the generated code also dependent on the sys table?

Thanks ....

 

ps. In your codefile : SqlSchemaToModel.cs the function GetTableCount still uses the query : "select count(*) from sysobjects where Type = 'U'"

seems like that query wouldn't work on a SQL2005 Db. I don't know if that function is still in use, but now you know ;)

 

Coordinator
Dec 29, 2010 at 2:09 PM

I am glad to hear you identified the issue but the bad news is we only support 2005 and above. What you found is an issue and there are a few statements like that. Actually there are not many but we have never tested it against SQL 2000. Also much of the paging code I know would not work as the syntax is newer. I am sorry but we just did not target that platform.