The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by dplante]

I have had the dreaded error trying to use the LoadSQLServer program:
Error creating database: (17)
System.Data.SqlClient.SqlException: SQL Server does not exist or access denied
at System.Data.SqlClient.SqlConnetction.Open()
at ADONETUtilities.SQLServerCreator.CreateDatabase(String strDatabaseName,
String strUserId, String strPassword)

But I did find a workaround, and I think if you do this, this should work for
you.

First, you need to know the name of your MSDE server, as in machine name and
server. You can see this in the SQL Server Service Manager dialog. If you
installed MSDE as part of the .NET Framework, your server instance is probably
called {yourMachineName}NetSDK.

Here's what I did:
1. I opened the project UtilitySource in the directory UtilitySource into VS.NET
2. I set the startup project to be LoadSQLServer
3. I edited the file SQLServerCreator.cs. There are two occurences of the
string localhost in connection strings. Change BOTH of them to
(local){YourSQLServerName}. For whatever reason "(local)" is the only
syntax that I've been able to get to work to refer to your localhost (your
machine). You could always try putting in your machine name here
4. rebuild the project and run (hit F5)

To be even more clear about step 3, in the connect method, the line you need
to change would change from:

sb.AppendFormat("Server=localhost;Initial Catalog =
{0};UID={1};PWD={2}",strDatabaseName,strUserId,strPassword);

to:

sb.AppendFormat("Server=(local)NetSDK;Initial Catalog =
{0};UID={1};PWD={2}",strDatabaseName,strUserId,strPassword);

and again, a similar change would be required in the CreateDatabase method.

Best of luck to all of you!

I did a search on the string 'localhost' in the files installed, and saw it in
every project. I would recommend changing every connect string as I suggested
above!

I don't have SQL Server running, so I don't know for sure if this wouldn't
work for that database.

Arlen - I would consider trying to run your code on a machine with just MSDE
installed, and see if you are able to replicate the problem that has been
described. If you could also try doing the change above and testing it on a
SQL Server database to see if it is compatible, that would be great. The next
step would then be to have a prompt in the install process that asks user if
they are using MSDE, and what their full path to their SQL Server instance is,
and filling in the values automatically.

Hope this helps everyone! (and Arlen, thanks for putting up the code for your
utility - I wouldn't have been able to get around this problem without the
code (and the debugger for that matter!)

Dom
import-bot (20211) [Avatar] Offline
#2
Re: how I got around MSDE LoadSQLServer problems
[Originally posted by arlen]


Dom -

Thanks for figuring this out. As you have probably realized, I don't do a lot
of testing with MSDE.

I just tried the (local) notation on SQL Server and it seems to work with no
problems, but I would like to do some additional testing and research before
changing the loader.

Thanks again,

Arlen