c#+SQL SERVER2000(见Visual C#数据库高级编程224-226页)

先在master 数据库建立存储过程
CREATE PROCEDURE BackUp_pubs
@Device_Name Varchar(80),
@File_Name Varchar(125)
As

If Exists(Select @File_Name)
Begin
     --创建数据库备分逻辑设备
      Exec Sp_Addumpdevice 'Disk',@Device_Name,@File_Name
    --备份数据
     Backup Database pubs To @Device_Name
End
GO


C#中如下代码

        private void button1_Click(object sender, System.EventArgs e)
        {
            SqlConnection myConnection=new SqlConnection("persist security info=False;Integrated Security=SSPI;server=localhost;Trusted_Connection=true;database=master");
            SqlCommand myCommand=new SqlCommand("BackUp_pubs",myConnection);

            myCommand.CommandType=CommandType.StoredProcedure;
            try
            {
                SqlParameter parameterDevice_Name=new SqlParameter("@Device_Name",SqlDbType.VarChar,80);
                parameterDevice_Name.Value=textBox1.Text;
                myCommand.Parameters.Add(parameterDevice_Name);

                SqlParameter parameterFile_Name=new SqlParameter("@File_Name",SqlDbType.VarChar,125);
                parameterFile_Name.Value=textBox2.Text;
                myCommand.Parameters.Add(parameterFile_Name);

                myConnection.Open();
                myCommand.ExecuteNonQuery();
            }
            catch
            {
                myConnection.Close();
                MessageBox.Show("检查您的参数!","提示",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
                return;
            }
            myConnection.Close();
            MessageBox.Show("成功!","提示",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
        }
编译运行程序,在textBox1中输入MyDevice 在textBox2中输入D:\MyBackup
然后点button1,会跳出来说检查您的参数!
不知道是哪错了