日期:2014-05-18  浏览次数:20949 次

把数据库中的表复制到另一个数据中出现了错误
c#窗体应用程序下,点击按钮 完成复制。我有两个数据库,Monitor数据库包含表Project,现在想把Monitor数据库中的表Project复制到 CkMonitor数据库中,写了如下代码,结果说Monitor.Project不存在,该怎么解决??
C# code

private void button1_Click(object sender, EventArgs e)
        {
string strSrc = "Server=LIUKAI-THINK;Integrated security=SSPI;database=CkMonitor"; 
string strSrc = "Server=LIUKAI-THINK;Integrated security=SSPI;database=CkMonitor"; 
using (SqlConnection thisConnection = new SqlConnection(strSrc))
 {
      thisConnection.Open();    
      string sql = "SELECT * INTO CkMonitor.Project FROM Monitor.Project";
      SqlCommand cmd = new SqlCommand(sql,thisConnection);
      cmd.ExecuteNonQuery();
 }
}



------解决方案--------------------
SELECT vale1, value2 into 数据库1.dbo.Table2 from 数据库1.dbo.Table1