日期:2014-05-17 浏览次数:20465 次
/// <summary> /// 增加公告信息 /// </summary> /// <param name="e"></param> public static void addAnnouncement(Equipment e) { string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.Web.HttpContext.Current.Server.MapPath("设备管理_be.mdb");//ACCESS链接字符串 OleDbConnection connAcc = new System.Data.OleDb.OleDbConnection(strConn); connAcc.Open(); string sql = string.Format("INSERT INTO 公告管理 VALUES('{0}','{1}','{2}','{3}','{4}','{5}')", new OleDbParameter("发布人",e.发布人), new OleDbParameter("主题", e.主题), new OleDbParameter("发布时间", e.发布时间), new OleDbParameter("内容", e.内容), new OleDbParameter("响应情况", e.响应情况), new OleDbParameter("备注", e.备注) ); OleDbCommand cmd = new OleDbCommand(sql, connAcc); cmd.ExecuteNonQuery();//这一步标准表达式中数据类型不匹配 connAcc.Close(); } //是不是代码哪里写的有问题?