问题描述
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
推荐答案
DELETE FROM //小心!
问候,
Jeff
Q1:如何手动传输SQL数据库?
mySqlCommand4.CommandText =" EMPTY people
***通过开发人员指南发送 ***
不要只参加USENET ......获得奖励!
DELETE FROM // be careful!
Regards,
Jeff
Q1: How can I transfer an SQL database manually?
mySqlCommand4.CommandText = "EMPTY people"
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!
这篇关于转移SQL数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!