vs2005 DataSource Question

SteveInBeloit

Well-known member
Joined
May 22, 2006
Messages
132
Programming Experience
10+
Hello,
I am learning about VS2005 datasources. I have worked through walkthroughs where I added a Data Source to my project, then added the tables to me forms so I could display and update table data. All works well.

When I move this code from this server to a production server, where the server name and logon parameters will be different, how will the code know? I think it will still be looking for the server and DB I use when I develop it. Since I don't supply the credentials anywhere in the code in the form of a connection string, how will it know the new customers server name and logon?

Thanks,
Steve
 
cjard,
That is a very good thread to read, up until the last half with the problems! That part scared me.
But I went to the Solutions Explore, choose properties of my project, then selected the settings tab and I see the connection string. For me transfering this project from the office to my house every night, can I edit the connection string here to match where I am at?

I also see the connection string is stored in app.config. What if I edited it there before taking it home to my development box there?

Thanks for the info,
Steve
 
That would be fine..

If you are only ever going to edit this connection string at design time, not run time, then you dont need to change it from a (Connection string)/App scope to a string/User scope and your app will not suffer any of the problems

You might also consider setting up your home machine like your work machine.. What is the connection string right now that you are using?
 
Here is the current connection String:

Data Source=cpserver;Initial Catalog=ForkLiftClientSQL;Persist Security Info=True;User ID=sa;Password=sa

So it is doable to edit this prior to moving it to a different server. I am only installing this particular piece at one customer. So theoretically, I could finish the project, edit this connection string, build my install package, and deliver it. Providing that i don't spell something wrong.... But that would work?

Thanks
 
It would... I jsut thought that maybe you could make an entry in your HOSTS file so that your home database server can also be reached by use of name "cpserver"

Note that the client must also have a db machine called cpserver

You know what I mean? Alias your home SQLServer so that it can be reached through use of "cpserver" name..
 
Back
Top