新手问题(asp如何联接ACCESS数据库)?
asp如何连接到ACCESS数据库,并且读写里面的数据,哪们朋友能给一些完整的参考代码吗?
而且听说在本地的联接,和传到网上服务器的联接方法是不同的,有哪些不同啊?
[解决办法]
db_path= "数据库路径 "
set conn=server.createObject( "ADODB.Connection ")
connstr= "Provider=Microsoft.JET.OLEDB.4.0;Data Source= "&server.mappath(db_path)
conn.open connstr
[解决办法]
连接:
dbpath= "bbsdata.mdb "
set conn=server.createobject( "adodb.connection ")
db= "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = "&server.mappath(dbpath)
conn.open db
删除:
conn.execute( "DELETE FROM [guestbook] WHERE id= "&id)
增加:
conn.execute( "INSERT INTO [guestbook](username,useraddress,usermail,usertel,userfax,userhome,sendinfo, UserIP) VALUES( ' "&username& " ', ' "&useraddress& " ', ' "&usermail& " ', ' "&usertel& " ', ' "&userfax& " ', ' "&userhome& " ', ' "&sendinfo& " ', ' "&Request.ServerVariables( "REMOTE_ADDR ")& " ') ")
修改:
conn.execute( "UPDATE [guestbook] SET reply= ' "&reply& " ',replytime= ' "&now()& " ' WHERE id= "&id)
[解决办法]
set conn=Server.CreateObject( "ADODB.Connection ")
conn.Provider= "Microsoft.Jet.OLEDB.4.0 "
conn.Open server.MapPath ( "/abc.mdb ")