marric

Would there be a way to make the c# connection string to the sql database universal, so that it can be passed from one computer to another

It's for a school project, so security isn't an issue.


Re: .NET Framework Data Access and Storage sql question

Figo Fei - MSFT

Hi, marric

What do you mean by universal

If you want to make several machines connected to a sql engine as server, just set the same remote connect string in app in all clients computer.

If you mentioned is asp.net app with sql engine in same server, others dont need to set anything, just use browser.

If you can make it clearer, pls feel free to let me know.

Thank you






Re: .NET Framework Data Access and Storage sql question

marric

Sorry for the lack of clarity.

There are 6 people in the class, each of which have our own hard drives with our own version of sql server on them. None of them are connected because they are all at our respective houses.

My part of the c# project we are working on involved doing a sql database, so the connection string in the program is for my version of sql, but if the others want to run the program, they will have to go in and change the string to match their server name, password, etc.

I know it's not a big deal, but I am curious if there is a way to avoid that.

Which also brings me to another issue. What's the best way to get my database to them

Right now I'm thinking save it as a backup to a jump drive, then they can import that into their server

Does that make sense

I appreciate your help.

Thanks.





Re: .NET Framework Data Access and Storage sql question

frederikm

Hi

one thing you could do is save the connection string in the app.config

http://msdn2.microsoft.com/en-gb/library/ms254494(vs.80).aspx

For the database it depends:

if you have data in the database, a backup is a viable option

otherwise you could script the database, letting them create it again

also for things like this consider using source versioning system (cvs for short)

http://sourceforge.net/

This would make sharing code a lot easier :)

Hope this helps you out, please close the thread if it does






Re: .NET Framework Data Access and Storage sql question

marric

I think that was what I was looking for.

Thanks.





Re: .NET Framework Data Access and Storage sql question

boban.s

Why you all don't use same DB engine, like SqlExpress. Connection string must be configurable, and defined in one place. You can also create one simple form that will be shown when connection to the database is not established, with fields for all properties of connection string. So you will change that first time when moving to new database.
Moving database is best with database backup if you work on sql server, but you can also take mdf file which requires detaching database (preffered for SqlExpress), and last taking script of objects and data of the database.