System.Data.SqlClient.SqlException occurred
HResult=0x80131904
Message=Invalid object name 'Drivers.DriversDetailTable'.
Source=.Net SqlClient Data Provider
StackTrace:
<Cannot evaluate the exception stack trace>
Keep getting the above error everytime i try and copy stuff from one database table to another, heres my code.
SqlConnection connect = new SqlConnection($@"Data Source = Computer\SQLEXPRESS;Initial Catalog = Drivers;Trusted_Connection=True;");
connect.Open();
SqlCommand cmd = new SqlCommand($@"SELECT * INTO BackUpDatabase.DriversDetailTable FROM Drivers.DriversDetailTable", connect);
cmd.ExecuteNonQuery();
connect.Close();
INSERT INTO ... SELECTwhich seems to be more common in other databases. And you should specify column names if possible.