mdf

Converting MDF to SDF

让人想犯罪 __ 提交于 2019-12-11 10:38:10
问题 I've done a bit of Googling trying to find out how to convert a .MDF file to a .SDF . There doesn't seem to be much around apart from an old article for something called 'SQL Server to SQL Server Compact Edition Database Copy Utility'. As this is so old, I doubt it will work with the newer versions of SQL Server databases. Is there a more established and official method of achieving this now? Ideally I need something that will migrate the data as well as the table structures. 回答1: You can use

Packaging a C# application with a database

前提是你 提交于 2019-12-11 08:42:41
问题 I have packed a WPF C# application that is using a database. However, when I install the packaged application it is using the database I created at the start through visual studio (.mdf) rather than creating another one. The whole purpose of packaging the application was so that I could share it on other computers, so I was install it I need it to create a new database for that instance of the application. Is there a way to accomplish this? Is there a property I need to set to say that the

How to deploy C# exe with .Mdf file?

天涯浪子 提交于 2019-12-11 02:16:10
问题 I have created windows application and i have created local database and added user name and password If username and password is correct then i have to open the code. I have generated a Setup.Msi , but when i try to install in my machine its working correctly But when i try to install the same exe in some other machine which is not having .Net or anything related to sql server .. It shows errors..it cant able to read .Mdf file...How to do it please. help me in this <add key="Connection"

how can i see data in mdf file

人盡茶涼 提交于 2019-12-10 13:38:24
问题 i have asp.net application. it has App_Data folder. this folder contain mdf and ldf file. how can i see data within these file. i want to see table structure. 回答1: Using SQL Server Management Studio Express you can attach that file. How to attach a file However, if you are viewing that in a project in Visual Studio, you can see that in the server explorer. Also, here is a similar question on the asp.net forums. 来源: https://stackoverflow.com/questions/1711152/how-can-i-see-data-in-mdf-file

how to convert Mdf/ldf database files to .bak file (db restore) using T-SQL or .net code

左心房为你撑大大i 提交于 2019-12-07 06:41:45
问题 I have sql server database files (Mdf/Ldf) and i want to convert them to backup file using T-SQL commands or .net Code (C# or Vb.net). any suggestions. thans 回答1: BACKUP DATABASE [NameOfDatabase] TO DISK = N'D:\path\filename.bak' WITH NOFORMAT, NOINIT, NAME = N'NameOfDatabase-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10 Replace NameOfDatabase with name of your database. Replace D:\path\filename.bak with place you want to backup with Replace Name = N database name for cosmetic

how to deploy .mdf file

喜夏-厌秋 提交于 2019-12-07 02:46:14
问题 I am trying to make an application, which uses a local .mdf database file (not attached to a sql server). Visual Studio says I have to install SQL Server Express before doing that. I was wondering how I can deploy the application to clients' box. Do they also need SQL Server Express installed? Thanks a lot 回答1: They need SQL Server Express installed. Once installed, you need to attach the database file (.mdf) to the server. 回答2: Don't deploy MDFs. Have your application use deployment scripts

how to convert Mdf/ldf database files to .bak file (db restore) using T-SQL or .net code

北城余情 提交于 2019-12-05 11:23:41
I have sql server database files (Mdf/Ldf) and i want to convert them to backup file using T-SQL commands or .net Code (C# or Vb.net). any suggestions. thans BACKUP DATABASE [NameOfDatabase] TO DISK = N'D:\path\filename.bak' WITH NOFORMAT, NOINIT, NAME = N'NameOfDatabase-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10 Replace NameOfDatabase with name of your database. Replace D:\path\filename.bak with place you want to backup with Replace Name = N database name for cosmetic indexing reasons... Original source - http://forums.asp.net/p/1448416/3870094.aspx 来源: https://stackoverflow

Attach (open) mdf file database with SQL Server Management Studio

廉价感情. 提交于 2019-12-04 22:18:41
Can you help me how can I open *.MDF file of database created with VisualStudio 2010, into SQL Server Management Studio? Tried to attach by myself, but I cannot navigate to that file for (I guess) some security reason. Rakeshyadvanshi I had the same problem. system configuration:-single system with window 7 sp1 server and client both are installed on same system I was trying to access the window desktop. As some the answer say that your Sqlserver service don't have full access to the directory. This is totally right. I solved this problem by doing a few simple steps Go to All Programs-

How to rename the Physical Database Files

别说谁变了你拦得住时间么 提交于 2019-12-04 19:39:40
问题 I have used tsql to detach a database like this: EXEC sp_detach_db @dbname = 'my_db' I then made use of PHP to rename the physical files. I was able to rename the mdf file but not the ldf file! I even tried a dos command REN but that didn't work for the ldf file either! I wanted to ask, is there something special about the physical log files that allow it not to be renamed? Is there a better way of doing this? Thanks all 回答1: Detach the Database, Rename the files, Attach it again. 回答2: You

how does one programmatically create a localdb .mdf?

心已入冬 提交于 2019-12-04 12:22:36
how does one programmatically create a localdb .mdf? acceptable solutions exclude visual studio, ssms, aspnet_regsql. a naive stab at a solution might look like this: static void Main(string[] args) { using (var con = new SqlConnection(@"Integrated Security=SSPI;Data Source=(LocalDb)\v11.0;AttachDbFilename=test.mdf")) { con.Open(); using (var cmd = new SqlCommand("CREATE DATABASE test", con)) { cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); } } } but of course, this fails in SqlConnection.Open with the error An attempt to attach an auto-named database for file test.mdf failed. A