I have installed an application and each file saved is .mdf. During installation of the software I have not seen any database being installed, and after installation I checked my program files and not SQL server or other database server being installed. I though the application would have an embedded database, but SQL Compact should only generate .sdf file, not .mdf file - what kind of embedded database sever would create .mdf file?
There's a fair chance that Sql Server Express User Instances are being used. Though if you're sure that you've checked both Program Files and Program Files(x86) and can't see any references to Sql Server then that can't be the case. That said, use the Services management console (Start > Services.msc) and look for services whose names start with "SQL Server" to verify that for definite.
One thing worth bearing in mind is that just because an application saves files with an extension of .mdf that doesn't mean that the files are Sql Server files. I could save a text file in notepad as myfile.mdf, but that still wouldn't make it a Sql Server file.
All of the other editions of SQL use .mdf files. See here: http://msdn.microsoft.com/en-us/library/ms233817.aspx
Another way to check if some SQL database is running is checking your Services management console. even SQL express should have a service.
Related
How can I publish a C# project with a .mdf database? I would like that it can be setup easily and need not install a sqlserver. Do I need to change to .sdf?
The Project only uses it in local.
.MDF files are SqlServer main data files, i doubt you can use them without SqlServer installed, as for SqlServer Compact Databases (.sdf) they can be used like you want but converting from one to another isnt just a matter of changing the extension, they are db with different formats.
You would need to create a new .sdf and replicate the schema you have in your .mdf and then copy your data somehow, also you would need to adapt your project since access to data on an .sdf is different than an .mdf not to mention .sdf doesn't support all the things that .mdf does
Why don't you simply deploy your application with .mdf file along with a SQL Local DB installation on user machine who doesn't havd Visual Studio installed?
Make sure you install proper LocalDB. i.e. x86 version of installer on 32 bit and x64 installer for 64 bit machine. There is two different installer for both achitechture.
Sql Server is not installed as part of Windows installation, so you cannot use an *.mdf file in your app unless Sql Server has been installed and you have appropriate permissions for it.
It is possible to distribute either Sql Server Express Edition or Sql Server Compact Edition (recommended) with your app.
MDF files are part of SQL server databases. Without SQL Server (or Express), you can't use them.
If you need an embedable database, SQLite is a good option. Firefox also ships with an embedded SQLite instance, so it's a good/proven option. SQLite also integrates well with ADO.NET; I wrote an article on that here.
Let's suppose I made an application in .net using sql server as database.
So if I want to deploy my application to some another PC i have to instal sql server
but I want that i should not install the sql server and my database should be automatically installed
i just want to make sure that is the concept of Local Database can fulfill my requirement
if so then how is it possible for me
thanks
You can use App_Data folder in the visual studio to store your .mdf files.Once you transfer your solution to a different system , the db file will be transferred automatically.
http://msdn.microsoft.com/en-us/library/ex526337.aspx
You should run your SQL server on a separate computer (server) to avoid having to install SQL server on all client computers. This way all PCs running your application can share a single instance of SQL Server.
If you want a single user DB per application instance I would recommend using SQL Compact edition instead
You can use SQL2012 Express Edition LocalDB. This uses a self contained file for your database, and can be installed as a prerequisite. When your application installs, you can install a blank database file, and connect to it.
SQL Server is not a small application that will be installed automatically and will require setup and configuration. You can however use it remotely. Or consider using an embedded database. But if you want to use a local database, you can use your mdf file of the database as a local database.
I created a software using .net4 which uses ORM and connects to database. So when I need to connect to a file I have to first open SQL Server Management Studio and attach the database to it and then I am able to use my software if I don't do this it throws an exception that the underlying provider failed to open.
Now I want to deploy the software to my brothers computer who doesn't have Visual Basic and SQL Server installed on his computer (but he has the .net framework) so is there a way I can modify my app.config to point to the database file instead and I don't need to attach the file to the SQL Server?
Simply I don't want to attach or detach the file to the database again and again how can the .net automatically attach it.
Indeed, install the SQL Server 2012 Express LocalDB (it is likely already installed with your Visual Studio 2012 installation) and then modify the connection string as follows:
connectionstring="data source=(LocalDB)\v11.0;attachdbfilename=c:\MyDatabaseFile.mdf;integrated security=True;"
the (LocalDB)\v11.0 part is where you point at the LocalDB "instance", and you can attach any mdf file you want. Keep in mind that this locks up the mdf file, so you cannot have it open in Management Studio and run your app.
You mentioned attaching a database, but not wanting to install SQL Server. I would take a look at the SQL Server Express LocalDB. While it is technically installed, it is not installed as a Windows Service, so it is much lighter than full SQL server or SQL Express.
i have a winform application in c#on visual studio, connected to a database in sql server 2008 and i have done a deployment to it so to use it i must install the sql server management studio and restore the database backup, so Can i when doing the deployment and setup project include or take the database backup to not need to install the SQL server management studio on the PC use this application and from the application i will take a backup from the updated database which has new records
So how do i make a deployment and setup project and embedded in it the database used so i'll not be needed to install the sql server in the PC which act as a server and the clients PCs as i want to use the application in a network?
If your database is trivial, should be accessible from a single computer and is used to store local data look to the.
http://www.microsoft.com/sqlserver/2008/en/us/compact.aspx. For sure you will need to read additional articles about how to use it and deploy it, but this should be a starting point. NOTE: you will not have stored procedures and advanced SQL Server features, but you will use the same code as you do now.
Note that if you want to restored a database from backup to an arbitrary SQL Server instance, you may encounter problems if the instance to which the backup is being restored is configured with options different than the original SQL Server instance (e.g., collation sequence, case-sensitivity, ANSI settings, etc.) If the default collation sequence is different, you may have problems with indices, for instance.
You can use sqlcmd for that, it installs with MSSQL server on client machine look here for details.
After you created bat file, you can run it from code use Process.Start
It's not the SQL Management Studio that is needed to be installed to make the program work, it's SQLServer that must be installed.
For small applications it maybe to much of work to administrate a SQLServer, in that case its better to use other database types... I used to use XML files, lately I use Sqlite, its very good no installation required. and it integrates great into Visual Studio.
Edit: If you only need to restore a .bak you could use that http://sqlbackupandftp.com/restore/ its very nice and easy, and its a very small file.
I have a brand new database on an ISP which I intend to use to build an ASP.NET data-driven website. However, I would like to build the whole thing locally and transplant the database to the ISP.
I have TCP/IP access (i.e. I can connect to the remote database directly thru SQL Server Management Studio Express), but I do not have Terminal Services access, as this is a database shared with other users of the ISP.
Is there a simple way to "replicate" my local development database to the remote server?
One way is to use something like the Database Publishing Wizard to create an SQL script, and then run that script in SQL Server Management studio in the remote database.
Apparently this is integrated in Visual Studio 2008 (didn't know that before).
I just had a similar problem. I downloaded and used the SQL Server Pulishing Wizard.
Can be found here. You end up with a single script file that you apply to your database and it creates everything including the data.
You could just backup the database on your local server and restore it onto the target server. This'd be easier if the collation of the two servers were the same, but even that's not a show-stopper. Scripting the database is fine while it's empty, but it gets trickier if you want to move it back and forth once it has data in it.
How about putting your database in the App_Data folder? You can create it straight from Visual Studio. It should then auto-mount. Then you should be able to just copy it over with the rest of the files.
Assuming you have FTP access, upload a "COPY ONLY" backup of the database to the server and then use Management Studio express to restore the backup and browse to the file and restore it on the server. Should work ok if the SQL version is compatable.