asp怎么连接sql数据库?
asp连接sql数据库的方法有四种,如下:
第一种写法:MM_conn_STRING = "Driver={SQLServer};server=(local);uid=sa;pwd=;database=infs;"Set conn = Server.Createobject("ADODB.Connection")conn.open MM_conn_STRINGSET RS=SERVER.CreateObject("ADOBD.recordset")SQL="SELECT * FROM TABLE ORDER BY ID DESC"RS.open SQL,CONN,3,3第二种写法:(DSN连接)MM_conn_STRING="DSN=BBS;UID=SA;PWD=12345"Set conn = Server.Createobject("ADODB.Connection")conn.open MM_conn_STRINGSET RS=SERVER.CreateObject("ADOBD.recordset")SQL="SELECT * FROM TABLE ORDER BY ID DESC"RS.open SQL,CONN,3,3// 3,3是修改、删除、增加开关!第三种写法:MM_conn_STRING_own = "Driver={SQLServer};server=(local);uid=sa;pwd=11111;database=infs;"Set conn = Server.Createobject("ADODB.Connection")conn.open MM_conn_STRING_own第四种:这种方法用在ACCESS中strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" _& Server.MapPath("asp.mdb")set conn = server.createobject("adodb.connection")conn.open strconn以上就是asp怎么连接sql数据库?的详细内容,更多请关注小潘博客其它相关文章!