با سلام برای بازیابی دیتابیس sqlserver در #C کدی نوشتم خطای زیر رو میده:
Incorrect syntax near 'G:\HotelBackup\mybackup.bak'.
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
کد ضمیمه است...
کد هاتون رو توسط ادیتور قرار بدید.
if (txtpath.Text=="") { errorProvider1.SetError(txtpath,"مسیر بازیابی را مشخص نمایید"); return; } btnbrowes.Enabled = false; btnRestore.Enabled = false; try { errorProvider1.Clear(); SqlConnection.ClearAllPools(); con = new SqlConnection("server=AHMAD; DataBase= DBHotel; integrated security=true"); SqlCommand smd = new SqlCommand(); string query = "USE [master];RESTORE DATABASE[DBHotel] FROM DISK N'" + txtpath.Text + "' WITH NOUNELOAD, REPLACE, STATS=10"; smd.Connection = con; smd.CommandTimeout = 100; con.Open(); smd.CommandText = query; smd.ExecuteNonQuery(); con.Close();
این لینک رو ببینید
هیچ کاربری تا کنون از این پست تشکر نکرده است
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)