Deployment issue - Error 26

  • Thread starter Flomo Togba Kwele
  • Start date
F

Flomo Togba Kwele

I am developing a forms app on a Windows XP machine with VS 2005 and also a
copy of SQL Server 2005 Developer.

The target environment is a dedicated server running SQL Server 2005 Standard
and client machines running the VS2005-developed code on Windows XP. Initial
testing looked OK after changing the connection string in the app config file.

However, I get an error whenever I run an app which uses strongly-typed
datasets - Error 26 - Error Locating Server / Instance Specified.

There are six projects in the solution. One is for forms, another is for data
access. I put all the dataset definitions in the latter. I created the datasets
using the Data Sources window and Add New Data Source.

The first time I used that option, it asked me how to log onto the SQL server.
It built a connection string and stored it in the Project settings for the data
access project (Settings.settings). It hard codes the development connection
string into Settings.Designer.vb, but also exposes a readonly property to
retrieve the string. During compilation, it copies this string into the
app.exe.config file, in the <connectionStrings> element of the <configuration>
section.

I changed the value of this connection string on the client running against the
Standard server, but obviously it's not being used when using datasets.

I must be missing something here. How else can I manage connection strings at
deployment?

Thanks, Flomo
--
 
W

WenYuan Wang [MSFT]

Hi Flomo

We need to perform more research on this issue . We will reply here as soon
as possible.
If you have any more concerns on it, please feel free to post here.

Thanks for your understanding!
Best regards,
Wen Yuan
 
W

WenYuan Wang [MSFT]

Hi Flomo,

Thanks for your waiting. Library class will not read the connection string
from its app.config file. However, it will load the connection string from
your WinForm project's app.config file.

Just add the same connectionStrings key and value as your library project
into the app.config file which is in your Winform project.library will read
this value from there and connect to your database server. However, when
you deploy your application, you can modify this app.config file according
to your deploy Server.

Hope this helps. Please feel free to let me know if you have anything
unclear. I'm glad to assit you.
Have a great day,
Sincerely,
Wen Yuan
Microsoft Online Community Support
 
F

Flomo Togba Kwele

Wen Yuan,

Thanks for the help. Still can't get it to work however. It's my ignorance of
the app.config file.

I have the following in the config file:

<connectionStrings>
<add name="MailHouse2ConnectionString" connectionString="..." />
</connectionStrings>

"MailHouse2ConnectionString" is the property name in the Settings for the
project. Is there another section it should be in rather than
connectionStrings, or have I specified it incorrectly?

At runtime it is using the connection string from the default attribute for the
property name, not the above value.

Thanks, Flomo
Hi Flomo,

Thanks for your waiting. Library class will not read the connection string
from its app.config file. However, it will load the connection string from
your WinForm project's app.config file.

Just add the same connectionStrings key and value as your library project
into the app.config file which is in your Winform project.library will read
this value from there and connect to your database server. However, when
you deploy your application, you can modify this app.config file according
to your deploy Server.

Hope this helps. Please feel free to let me know if you have anything
unclear. I'm glad to assit you.
Have a great day,
Sincerely,
Wen Yuan
Microsoft Online Community Support





--
 
W

WenYuan Wang [MSFT]

Hi Flomo,
Thanks for your response.
I have the following in the config file:
<connectionStrings>
<add name="MailHouse2ConnectionString" connectionString="..." />
</connectionStrings>

"MailHouse2ConnectionString" is the property name in the Settings for the
project. Is there another section it should be in rather than
connectionStrings, or have I specified it incorrectly?

It looks fine. However, you can create an app.config file in your winform
project and copy the app.config from DataAccessLibrary to your Winform
Project.

At runtime if the application is using the connection string from the
default attribute for the property name, not the above value. It seems the
application can't read the section from app.config file.

However, I have sent you a sample.
a class library project include a stongle typed dataset and a winform
project has a reference to this library. You can modify the app.config file
in winform project to change the connect string.

You may reference it. Hope this helps.
Sincerely,
Wen Yuan
Microsoft Online Community Support
 
W

WenYuan Wang [MSFT]

Hi Flomo,

Just want to check whether the issue has been resolved.
Please feel free to let me know if there is anything we can help with.

Have a great day,
Sincerely,
Wen Yuan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top