日期:2014-05-18 浏览次数:21174 次
[WebMethod(Description = "接收日志记录")] public DataSet GetDataset(string SQL) { #region 将UserLog复制并改为带当前日期的MDB string NowDate = DateTime.Now.ToString("yyyy-MM-dd"); string[] jie = NowDate.Split('-'); string sourceFile = AppDomain.CurrentDomain.BaseDirectory + "\\App_Data\\UserLog.mdb"; string targetFile = AppDomain.CurrentDomain.BaseDirectory + "\\App_Data\\UserLog" + jie[0] + jie[1] + jie[2] + ".mdb"; if (File.Exists(targetFile) == false) { File.Copy(sourceFile, targetFile); } #endregion Connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+targetFile+";Persist Security Info=False"; OleDbConnection MyConn = new OleDbConnection(Connstr); try { MyConn.Open(); OleDbDataAdapter MyCommand = new OleDbDataAdapter(SQL, MyConn); OleDbCommand Mycmd = new OleDbCommand(SQL, MyConn); Mycmd.ExecuteNonQuery(); DataSet ds = new DataSet(); MyCommand.Fill(ds); MyConn.Close(); return ds; } catch (Exception ex) { throw ex; } }
MyConn.Open(); OleDbCommand Mycmd = new OleDbCommand(SQL, MyConn); Mycmd.ExecuteNonQuery();