Re: Calling Sql Server 2000 from C# Express



RvGrah,

Instead of hard coding your connection string, why not get that value
from a config file for your app? You should be able to do something like
this in your config file:

<connectionStrings>
<add name="MyLocalSQLServer"
connectionString="Initial Catalog=aspnetdb;
data source=localhost;Integrated Security=SSPI;"
providerName="System.Data.SqlClient"/>
</connectionStrings>

And then, in your code, you should be able to do:

// Get the connection string.
string connectionString =
System.Configuration.ConfigurationManager.ConnectionStrings["MyLocalSQLServer"];

Then, all you have to do is change the value in the config file, and you
don't have to worry about re-compiling your app anytime you want to specify
a different server.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx

"RvGrah" <rvgrahamsevatenein@xxxxxxxxxxxxx> wrote in message
news:1138898509.735188.13130@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
If I use a Sql Server 2005 Express copy of a database on my local
machine to develop my apps, can I then just substitute (Ctl+Shift + H
"replace all") the server name of my local machine with the server name
of our company server when I deploy this to my users?

I can't deploy versions calling my local development machine because
other apps talking to this same database are still based on VS 2003 and
some even from VB6, and they all need to talk to the same Sql Server.

Has anyone tried this? Yes, I'm going to try it myself, just loking for
input from fellow users. I want to get started in the VS 2005 world but
I'm not ready to buy the Professional version yet, want to see what I
can learn and do with Express version for a bit.

Thanx, Bob



.



Relevant Pages

  • Re: Deployment + Vista
    ... this past week I had to deploy an app onto a small ... I'm not a big fan of using the app.config file to handle my server settings. ... to the app directory and then discard them upon exiting the form. ... function in order to put together the connection string something like: ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Deployment + Vista
    ... The problem is it's connection string is always ... Server settings form. ... possibly occur with a file created by your app. ... I guess it's a good thing I do not use that for settings. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Deployment + Vista
    ... The problem is it's connection string is always ... Server settings form. ... possibly occur with a file created by your app. ... I guess it's a good thing I do not use that for settings. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Deployment + Vista
    ... I'm talking about the user being able to edit the server connection setting ... MSI will allow you to edit the app directory, ... function in order to put together the connection string something like: ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Unit testing
    ... App), the application takes many different input, ... server address port etc..... ... i wanted to write config file or text file that contains the ... suite in NUnit GUI that tells me that test passed or failed. ...
    (microsoft.public.dotnet.languages.csharp)

Loading