Smoke_1110
شنبه 03 اردیبهشت 1390, 00:44 صبح
سلام
من برای بکاپ این کد رو نوشتم ولی از این قسمت در کد که زیرش خط قرمز کشیدم ایراد میگیره که این ناشناخته است و تعریف نشده حالا باید این رو کجا تعریف کنم؟
try
{
string command = @"BACKUP DATABASE Mashmolin TO DISK='" + strFileName + "'";
this.Cursor = Cursors.WaitCursor;
SqlCommand oCommand = null;
SqlConnection oConnection = null;
oConnection = new SqlConnection("Data Source=.;InitialCatalog=Mashmolin;Integrated Security=True");
if (oConnection.State != ConnectionState.Open)
oConnection.Open();
oCommand = new SqlCommand(Sqlcommand, oConnection);
oCommand.ExecuteNonQuery();
this.Cursor = Cursors.Default;
MessageBox.Show("پشتیبان گیری با موفقیت انجام شد");
}
catch (Exception ex)
{
MessageBox.Show("Error Occurd :" + ex.Message);
}
ارور هم اینه :
The name 'Sqlcommand' does not exist in the current context
من برای بکاپ این کد رو نوشتم ولی از این قسمت در کد که زیرش خط قرمز کشیدم ایراد میگیره که این ناشناخته است و تعریف نشده حالا باید این رو کجا تعریف کنم؟
try
{
string command = @"BACKUP DATABASE Mashmolin TO DISK='" + strFileName + "'";
this.Cursor = Cursors.WaitCursor;
SqlCommand oCommand = null;
SqlConnection oConnection = null;
oConnection = new SqlConnection("Data Source=.;InitialCatalog=Mashmolin;Integrated Security=True");
if (oConnection.State != ConnectionState.Open)
oConnection.Open();
oCommand = new SqlCommand(Sqlcommand, oConnection);
oCommand.ExecuteNonQuery();
this.Cursor = Cursors.Default;
MessageBox.Show("پشتیبان گیری با موفقیت انجام شد");
}
catch (Exception ex)
{
MessageBox.Show("Error Occurd :" + ex.Message);
}
ارور هم اینه :
The name 'Sqlcommand' does not exist in the current context