Q1:如何手动传输SQL数据库?我有一个名为mydb的数据库 ,我查看了硬盘并发现它在 " C:\Program Files \ Microsoft Microsoft SQL Server \ MSSQL \Data"有2个文件一个 是mydb.mdf和lof文件。我在同一条路径上将这些复制在 另一台机器上但是无法使其工作??? Q2:我使用下面的代码来EMPTY一个名为people的表但 它不起作用???: SqlConnection mySqlConnection4 = new SqlConnection(" Initial 目录= mydb;数据源=" + comboBox1.SelectedItem.ToString()+ " ;;集成安全性= SSPI;"); mySqlConnection4 .Open(); SqlCommand mySqlCommand4 = mySqlConnection4.CreateCommand(); SqlTransaction myTrans; myTrans = mySqlConnection4.BeginTransaction(IsolationLevel.R eadCommitted,SampleTransaction); mySqlCommand4.Connection = mySqlConnection4; mySqlCommand4.Transaction = myTrans; mySqlCommand4.CommandText =" EMPTY人 ; //mySqlCommand4.ExecuteNonQuery(); myTrans.Commit(); mySqlConnection4.Close(); 无论如何有什么问题??? 任何帮助都将不胜感激... Cem Louis
Hi, Q1: How can I transfer an SQL database manually? I have a database which is named mydb, I looked at the harddrive and found it on "C:\Program Files\Microsoft SQL Server\MSSQL\Data" there is 2 file one of them is mydb.mdf and the lof file of that. I copied these on another machine on the same path but couldn''t make it to work??? Q2: I used the below code to EMPTY a table which is named people but it is not working???: SqlConnection mySqlConnection4 = new SqlConnection("Initial Catalog=mydb;Data Source=" + comboBox1.SelectedItem.ToString() + ";Integrated Security=SSPI;"); mySqlConnection4.Open(); SqlCommand mySqlCommand4 = mySqlConnection4.CreateCommand(); SqlTransaction myTrans; myTrans = mySqlConnection4.BeginTransaction(IsolationLevel.R eadCommitted,"SampleTransaction"); mySqlCommand4.Connection = mySqlConnection4; mySqlCommand4.Transaction = myTrans; mySqlCommand4.CommandText = "EMPTY people" ; //mySqlCommand4.ExecuteNonQuery(); myTrans.Commit(); mySqlConnection4.Close(); Anyway What is the problem??? Any help would be greatly appreciated... Cem Louis
推荐答案Cem ... 在传输文件之前,你需要暂停数据库并分离 使用 说OSQL Cem... Before you transfer the files you need to halt the database and detach it using say OSQL sp_detach_db''mydb'',''true''一旦你转移了mdf和ldf文件就需要附加它们 使用 说OSQL start - > run OSQL / U [mypassword] / P / S [myservername] sp_attach_db''mydb'',''pathtomdf'',''pathtoldf'' go exit sp_detach_db ''mydb'',''true'' Once you have transfered the mdf and ldf files you need to attach them using say OSQL start-->run OSQL /U [mypassword] /P /S [myservername]sp_attach_db ''mydb'',''pathtomdf'',''pathtoldf''goexit
DELETE FROM //小心! 问候, Jeff Q1:如何手动传输SQL数据库? mySqlCommand4.CommandText =" EMPTY people ***通过开发人员指南发送 http:// www.developersdex *** 不要只参加USENET ......获得奖励!
DELETE FROM // be careful! Regards, Jeff Q1: How can I transfer an SQL database manually? mySqlCommand4.CommandText = "EMPTY people" *** Sent via Developersdex www.developersdex *** Don''t just participate in USENET...get rewarded for it!
杰夫, 非常感谢你的关注...但我不认为我可以自己处理第一个问题。 ..我使用PHP大约2和一半 半年,但MSSQL给我带来了一点复杂。所以如果你有时间 我们可以通过msn在线进行吗?如果你有时间我的msn是 ce******@hotmail 和Q2:我知道MySQL的DELETE。我想逐一删除行 删除所有行...在MySQL EMPTY''mytable''中。是MSSQL中的DELETE 是删除所有行还是我必须逐个删除??? 非常感谢你... Cem Louis ***通过Developersdex发送 www.developersdex *** 不要只参加USENET ......获得奖励! Hi Jeff, Thank you very much for your attention... But I don''t think I can handle the first question by myself... I am using MySQL with PHP about 2 and a half years but MSSQL comes to me a bit complicated. So If you have time can we make this online by msn? If you have time my msn is ce******@hotmail And for Q2: I know DELETE from MySQL. Deletes rows one by one I want to delete all the rows... In MySQL EMPTY ''mytable'' . Is the DELETE in MSSQL deletes all the rows or do I have to delete one by one??? Thank you indeed... Cem Louis *** Sent via Developersdex www.developersdex *** Don''t just participate in USENET...get rewarded for it!
你好Jeff, 无论如何我把数据库移到了链接: www.support.microsoft/?id=224071 对我有帮助...无论如何什么 关于Q2? 谢谢... ***通过Developersdex发送 www.developersdex *** 不要只是参加USENET .. .get奖励它! Hi Jeff, Anyhow I moved the database the link: www.support.microsoft/?id=224071 was helpful... Anyway what about the Q2? Thank you... *** Sent via Developersdex www.developersdex *** Don''t just participate in USENET...get rewarded for it!
更多推荐
转移SQL数据库?
发布评论