نوشته شده توسط
veniz2008
سلام.
کدتون رو داخل تگ شارپ ( # ) بذارید تا کدهاتون قابل فهم تر و پش نوازتر باشن.
یه عکس از خطا بگیرید و بزارید.(عکس رو طوری بگیرید که کدهای برنامتون هم مشخص باشه).
سلام private void Backup(string strFileName)
{
try
{
string command = @"BACKUP DATABASE bbb TO DISK='" + strFileName + "'";
this.Cursor = Cursors.WaitCursor;
SqlCommand oCommand = null;
SqlConnection oConnection = null;
oConnection = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\bbb.mdf;Integrated Security=True;Connect Timeout=30;User Instance=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);
}
}
اينم مشكلشError 1 The name 'sqlcommand' does not exist in the current context 3