5,889
社区成员
发帖
与我相关
我的任务
分享
OleDbConnection oledbConn = new OleDbConnection("Provider=IBMDADB2.1;Location=192.168.1.8;Data Source=TESTDB;Persist Security Info=True;User ID=testuser;Password=Test123;");
string sql = "export to e:\data\mytab.txt of del select * from mytab";
OleDbCommand cmd = new OleDbCommand(sql, oledbConn);
try
{
if(oledbConn.State != ConnectionState.Open) oledbConn.Open();
System.Data.OleDb.OleDbDataAdapter adp = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
adp.Fill(ds);
DataTable dt = ds.Tables[0];
if (dt != null)
{
string strCount = dt.Rows[0][0].ToString();
//AddLog("共导出记录:" + strCount + "条到文件:" + outfile);
}
}
catch (Exception ex)
{
//AddLog("导出记录失败:" + ex.ToString());
}