How to take Back up of LocalDB C# my database file name is MyDatabase.mdf
问题 string dbpath= System.Windows.Forms.Application.StartupPath; string dbp = dbpath + "\\MyDatabase.Mdf"; SqlCommand cmd = new SqlCommand("backup database ['"+dbp+"'] to disk ='d:\\svBackUp1.bak' with init,stats=10",con); cmd.ExecuteNonQuery(); 回答1: Error was that "The identifier start with---- is too long. Maximum length is 128" so I Make the "MyDatabase.mdf" with small Name "MyDb.mdf".So the identifier becomes less than 128. My code is SqlConnection con = new SqlConnection(ConfigurationManager