string dir=Directory.GetCurrentDirectory().Trim();
System.IO.DirectoryInfo directoryInfo = System.IO.Directory.GetParent(System.IO.Directory.GetParent(dir).FullName);
dir=directoryInfo.FullName;
string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source=" +dir + @"\DataBaseInfo.mdb";
adc = new ADODBCreateDataSource.CreateDataSource.Create();
cn = new OleDbConnection ();
cn.ConnectionString = ADODBCreateDataSource.CreateDataSource.Create.connection;
cn1 = new System.Data.OleDb.OleDbConnection();
cn1.ConnectionString = strConn; cm1 = new OleDbCommand("SELECT * FROM DetailDataBase");
da1 = new System.Data.OleDb.OleDbDataAdapter(this.cm1.CommandText,cn1);
ds1 = new DataSet(); System.Data.OleDb.OleDbCommand cm2 = new OleDbCommand();
try
{
cn.Open();
cn1.Open(); }
catch(Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
try
{
da1.Fill(ds1);
node = new TreeNode(cn.ConnectionString,2,2);
DataRow myrow = ds1.Tables["table"].NewRow();
myrow["编号"] = 1;
myrow["DataBaseName"] = node.Text;
myrow["TableName"] = null;
myrow["ViewName"] = null;
myrow["SaveProcessName"] = null;
ds1.Tables["table"].Rows.Add(myrow);
dataGrid1.DataSource = ds1.Tables["table"];
try
{
OleDbTransaction Tran = cn1.BeginTransaction(IsolationLevel.ReadCommitted);
cm2.CommandType = CommandType.TableDirect;
cm2 = new OleDbCommand("INSERT INTO DetailDataBase (编号,DataBaseName) VALUES (1,node.text )", cn1,Tran);
da1.InsertCommand = cm2;
}
catch(Exception ee)
{
MessageBox.Show(ee.Message);
}
da1.Update(ds1,"table");
System.IO.DirectoryInfo directoryInfo = System.IO.Directory.GetParent(System.IO.Directory.GetParent(dir).FullName);
dir=directoryInfo.FullName;
string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source=" +dir + @"\DataBaseInfo.mdb";
adc = new ADODBCreateDataSource.CreateDataSource.Create();
cn = new OleDbConnection ();
cn.ConnectionString = ADODBCreateDataSource.CreateDataSource.Create.connection;
cn1 = new System.Data.OleDb.OleDbConnection();
cn1.ConnectionString = strConn; cm1 = new OleDbCommand("SELECT * FROM DetailDataBase");
da1 = new System.Data.OleDb.OleDbDataAdapter(this.cm1.CommandText,cn1);
ds1 = new DataSet(); System.Data.OleDb.OleDbCommand cm2 = new OleDbCommand();
try
{
cn.Open();
cn1.Open(); }
catch(Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
try
{
da1.Fill(ds1);
node = new TreeNode(cn.ConnectionString,2,2);
DataRow myrow = ds1.Tables["table"].NewRow();
myrow["编号"] = 1;
myrow["DataBaseName"] = node.Text;
myrow["TableName"] = null;
myrow["ViewName"] = null;
myrow["SaveProcessName"] = null;
ds1.Tables["table"].Rows.Add(myrow);
dataGrid1.DataSource = ds1.Tables["table"];
try
{
OleDbTransaction Tran = cn1.BeginTransaction(IsolationLevel.ReadCommitted);
cm2.CommandType = CommandType.TableDirect;
cm2 = new OleDbCommand("INSERT INTO DetailDataBase (编号,DataBaseName) VALUES (1,node.text )", cn1,Tran);
da1.InsertCommand = cm2;
}
catch(Exception ee)
{
MessageBox.Show(ee.Message);
}
da1.Update(ds1,"table");
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货