Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Guy007
Starting Member
6 Posts |
Posted - 2007-05-18 : 10:34:18
|
| Hi,I'm quite new to databases used in applications, but i'm somehow managing. I have created an application (using .net c#) which uses a database - Fine. Now i want to give my application to another person, so that he can install it and use it. The problem is how do i give him the database, that he can 'install' it in an automated way.what i mean is:1) I have a user called ABC on my SQL Server 2005, that has rights to the database i created. How can i automatically create the user ABC on his computer? (some script probably, but how do you write it and how does he execute it!)2) I give him my xyz.MDF database file. How can I make his SQL Server installation aware of this database? Usually I 'Attach' it manually from the Management Studio, but this is not something you expect the end user to do.Probably my questions might seem stupid and noob (sorry), but i really cannot figure out how to do it!Any help from you guys would be appreciated! |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-18 : 10:43:16
|
| this is not the way to do it.a database is on the central location and clients connect to it.This is not the same as access._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
Guy007
Starting Member
6 Posts |
Posted - 2007-05-18 : 10:53:41
|
quote: Originally posted by spirit1a database is on the central location and clients connect to it.
Maybe i wasn't clear enough sorry! I developed an application, and i want to give to different users to install. when you buy an application, for instance, it installs an copy of the database and tables with no data in them, then the tables start getting filled in with data as we go along. so i need a database on the users computer, not a central database somewhere in this case... |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-18 : 10:58:12
|
| hmm... well they'll have to download sql express for this before they install your app.then you can put the db create scripts in your setup program.another option is to use SQL Server CE which is just one .DLL you include in your project and it only runs when yourapp runs.however SQL CE has some limitations. No stored procedure, no triggers, no views, no full text etc...you can read more about it:http://www.microsoft.com/sql/editions/sqlmobile/sqlmobileresources.mspx_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-05-19 : 07:17:34
|
| "so i need a database on the users computer"Assuming they have SQL Server installed (one of the "lite" versions of SQL Server will do ... e.g. for Single User type Apps) you can either:Restore your "new database" from a BackupAttach the "new database" from Database Files.Then you need to create a user on the SQL Server, and add that user to your database.Ideally you will set up a Role in your Database that the new User can be associated with.In SQL this would be something like:EXEC sp_addlogin 'MyUserID', 'MyPassword', 'MyNewDBName' GOUSE MyNewDBNameGOEXEC sp_grantdbaccess 'MyUserID'GOEXEC sp_addrolemember 'MyRole', 'MyUserID'For this lot to work the user is going to have to provide some sort of SA credentials for the SQL Server ... so they will either need to know that, be a member of Administrators, or have just done a fresh install of SQL Server (e.g. "Lite" version!)Now that I've written that it looks like a fair amount of hassle :-(You could have a UserID already set up in your database and just "activate" that on the server. That's fine provided it doesn't clash with a UserID already created on the server [i.e. for some other purpose], so creating a userID that the user provides the name for is probably better.Kristen |
 |
|
|
|
|
|
|
|