虽然是多种方法,其实归根结底都是大同小异,只是书写上的差异而已;但正是这些书写格式也仍然是我们不容忽视的。
1、基本连接
strconnection="driver={mysql odbc 3.51
driver};server=localhost;uid=root;password=luo;database=gaorui;stmt=set
names gb2312"
set conn = server.createobject("adodb.connection")
conn.open strconnection
sql = "select * from user"
set rs = conn.execute(sql)
%>
2、定义变量连接
dim myHost,myDB,myUID,myPWD
myHost = "localhost"
myDB = "gaorui"
myUID = "root"
myPWD = "luo"
myChareSet = "gb2312"
strconnection="driver={mysql odbc 3.51 driver};server=" &
myHost & ";database=" & myDB & ";user name=" &
myUID & ";password=