我就与SQL数据库的项目和它的作品没有任何错误在Visual Studio 2012,但之后公布,并安装它,当我把备份它显示如下错误数据库中找不到发布后
“数据库“C :\ Users \ LU \ AppData \ Local \ Apps \ 2.0 \ D9HBHD8T.Y1H \ 5B2JMG1T.N8W \ game..tion_60f48512c0fd7b6a_0001.0000_7a5b2d8ced8c74c0 \ gamedata.mdf'不存在。确保名称为 输入正确。BACKUP DATABASE is终止异常。“
这里是我的程序
CREATE proc dbackup
@databaseName sysname,
@path nvarchar(400)
as
backup database @databaseName to disk = @path with init
return
这里是我的备用码:
private void button1_Click(object sender, EventArgs e)
{
DataBase db=new DataBase();
try
{
db.connect();
SqlCommand oCommand = new SqlCommand(@"dbackup",db.sqlcon);
oCommand.CommandType = CommandType.StoredProcedure;
oCommand.Parameters.AddWithValue("@databaseName", Application.StartupPath + "\\gamedata.mdf");
oCommand.Parameters.AddWithValue("@path", textBox1.Text);
oCommand.ExecuteNonQuery();
MessageBox.Show("Backup Created Sucessfully");
}
catch (Exception ex)
{
MessageBox.Show("Error Occurd :" + ex.Message);
}
finally
{
db.disconnect();
}
this.Close();
}
数据库中的'dbackup'过程'fees_data'? – 2014-09-20 04:24:31
类似的问题http://stackoverflow.com/questions/12588165/database-does-not-exist-error。即使有相同的数据库名称... – 2014-09-20 04:30:50
示例fees_data我的数据库名称是gamedata.mdf – saman 2014-09-20 04:33:49