471,317 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,317 software developers and data experts.

Calling Sql Server 2000 from C# Express

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

Feb 2 '06 #1
3 1206
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.Connecti onStrings["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]
- mv*@spam.guard.caspershouse.com

"RvGrah" <rv****************@sbcglobal.net> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
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

Feb 2 '06 #2
Thanks Nicholas, Ill try that.
I almost addressed the question directly to you, as I was pretty sure
you'd be the one to answer it.

Bob

Feb 2 '06 #3
I'm flattered, thank you!
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"RvGrah" <rv****************@sbcglobal.net> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Thanks Nicholas, Ill try that.
I almost addressed the question directly to you, as I was pretty sure
you'd be the one to answer it.

Bob

Feb 2 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by RDV | last post: by
10 posts views Thread by amjad | last post: by
1 post views Thread by theintrepidfox | last post: by
14 posts views Thread by Developer | last post: by
6 posts views Thread by Grey Alien | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.