c# 使用odbc连接access 遇到的问题。急急急 在线等解决办法
string sql = string.Format(@"UPDATE t_guest SET GUESTTYPE='{0}',GROUPID='{1}',
[NAME]='{2}',SEX='{3}',BIRTHDAY='{4}',IDTYPE='{5}',IDCODE='{6}',DISTRICTID='{7}',
[ADDRESS]='{8}',HOTELID='{9}',ROOMID='{10}',LTIME='{11}',LWAITER='{12}',ETIME='{13}',
EWAITER='{14}',PHOTO=?,FIRSTNAME='{15}',LASTNAME='{16}',
COUNTRY='{17}',NATION='{18}',SUMMARY='{19}',CREATETIME='{20}',
SCANTIME='{21}' WHERE GUESTID='{22}' ", guestType, groupId, model.ID_Name,
model.ID_Sex == "男" ? "1" : "2", model.ID_Birth.Replace("-", ""), idType,
model.ID_ID, districtId, model.ID_Addr, hotelId, model.Sign_RoomID, model.Oper_Date.ToString("yyyyMMddHHmm")
, string.IsNullOrEmpty(model.Oper_ID) ? "admin" : model.Oper_ID, "", "", "", "", country, nation,
sumMary, DateTime.Now.ToString("yyyyMMddHHmm"), DateTime.Now.ToString("yyyyMMddHHmm"), guestId);
System.Data.Odbc.OdbcParameter[] parm ={
// DBhelperForODBC.GetParameter("@GUESTTYPE",OdbcType.VarChar,guestType),
// DBhelperForODBC.GetParameter("@GROUPID",OdbcType.VarChar,groupId),
// DBhelperForODBC.GetParameter("@NAME",OdbcType.VarChar,model.ID_Name),
// DBhelperForODBC.GetParameter("@SEX",OdbcType.VarChar,model.ID_Sex=="男" ? "1" : "2"),
// DBhelperForODBC.GetParameter("@BIRTHDAY",OdbcType.VarChar,model.ID_Birth.Replace("-","")),
// DBhelperForODBC.GetParameter("@IDTYPE",OdbcType.VarChar,idType),
// DBhelperForODBC.GetParameter("@IDCODE",OdbcType.VarChar,model.ID_ID),
// DBhelperForODBC.GetParameter("@DISTRICTID",OdbcType.VarChar,districtId),
// DBhelperForODBC.GetParameter("@ADDRESS",OdbcType.VarChar,model.ID_Addr),
// DBhelperForODBC.GetParameter("@HOTELID",OdbcType.VarChar,hotelId),
// DBhelperForODBC.GetParameter("@ROOMID",OdbcType.VarChar,model.Sign_RoomID),
// DBhelperForODBC.GetParameter("@LTIME",OdbcType.VarChar,model.Oper_Date.ToString("yyyyMMddHHmm")),
// DBhelperForODBC.GetParameter("@LWAITER",OdbcType.VarChar,string.IsNullOrEmpty( model.Oper_ID) ? "admin" : model.Oper_ID),
// DBhelperForODBC.GetParameter("@ETIME",OdbcType.VarChar,""),
// DBhelperForODBC.GetParameter("@EWAITER",OdbcType.VarChar,""),
new OdbcParameter("@PHOTO",OdbcType.Binary,100000),
// DBhelperForODBC.GetParameter("@PHOTO",OdbcType.Binary,model.ID_Bmp),
// DBhelperForODBC.GetParameter("@FIRSTNAME",OdbcType.VarChar,""),
// DBhelperForODBC.GetParameter("@LASTNAME",OdbcType.VarChar,""),
// DBhelperForODBC.GetParameter("@COUNTRY",OdbcType.VarChar,country),
// DBhelperForODBC.GetParameter("@NATION",OdbcType.VarChar,nation),
// DBhelperForODBC.GetParameter("@SUMMARY",OdbcType.VarChar,sumMary),
// DBhelperForODBC.GetParameter("@CREATETIME",OdbcType.VarChar,DateTime.Now.ToString("yyyyMMddHHmm")),
// DBhelperForODBC.GetParameter("@SCANTIME",OdbcType.VarChar,DateTime.Now.ToString("yyyyMMddHHmm")),
// DBhelperForODBC.GetParameter("@GUESTID",OdbcType.VarChar,guestId)
};
DBhelperForODBC.ExecuteSql(sql, parm);以上是测试代码
如果直接拼接sql 不会报错,但二进制保存不全好像被截断,如果使用OdbcParameter 参数形式,则会在传二进制处报错,提示:ODBC Microsoft Access 驱动程序]非法的精确度数值, 求解?
...全文
相关推荐
C#使用ODBC与OLEDB连接数据库的方法示例
主要介绍了C#使用ODBC与OLEDB连接数据库的方法,结合实例形式分析了C#基于ODBC与OLEDB实现数据库连接操作简单操作技巧,需要的朋友可以参考下
Access2007ODBC驱动.rar
access2007的odbc驱动程序,本人亲测可用,其他人要分要得太厉害,同样的东西奉献给那些和我一样没分的兄弟
在Win8系统上使用ODBC连接Access2013数据库
使用access2013创建数据库及数据库表 在Win8系统上使用ODBC连接Access2013数据库
C#代码检查是否存在access的 ODBC
只是代码段,检查是否存在access的ODBC,创建access的ODBC,希望有用。
通过ODBC连接Access数据库
本实例是在Windows 2000下开发的,程序测试环境为Windows2000和WindowsXP。用户在Windows 98、 Windows 2000和Windows XP下都可使用本实例。


