最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp.net Access的数据库连接字符串总结
时间:2022-06-25 04:19:40 编辑:袖梨 来源:一聚教程网
1.access的数据库连接字符串。在web.config文件中配置access文件。
string constring = configurationmanager.apps教程ettings["conn"]+httpcontext.current.server.mappath("~")+configurationmanager.appsettings["source"];
2.access数据库对关键字敏感,对于password这样的关键字,需要加括号进行查询,否则会报错。
string querystring="insert into users([username],[password],[gendor],[createtime]) values(@username,@password,@gendor,@createtime)";
3.对于日期类型的字段,需要先转换为字符串,再转化为日期。
oledbparameter par=new oledbparameter("@createtime",convert.todatetime(userinfo.createtime.tostring());
4.access数据库的参数有严格的顺序,如果参数的顺序不对的话,执行时不会报错,但是不会做插入或更新操作,对数据库不会产生任何影响。
string updatestring = "update users set [username]=@username,[password]=@password,[gendor]=@gendor where [id]=@id";
oledbparameter[] pars ={
new oledbparameter("@username",userinfo.username),
new oledbparameter("@password",userinfo.password),
new oledbparameter("@gendor",userinfo.gendor),
new oledbparameter("@id",userinfo.id)};//如果将id参数写在前面,执行不会成功
相关文章
- 幻兽帕鲁雷冠龙捕捉位置在哪 帕鲁雷冠龙位置介绍 07-12
- Solana与Bullish达成关键整合,助力稳定币发展 07-12
- 幻兽帕鲁花冠龙哪里可以抓到 帕鲁花冠龙捕捉地点介绍 07-12
- 幻兽帕鲁秘斯媞雅在哪里出生 帕鲁秘斯媞雅出没地点介绍 07-12
- 剑星桃乐丝服装怎么获取 桃乐丝服装获取方式介绍 07-12
- 无畏契约源能行动星礈怎么玩 星礈实战技巧教学 07-12