2013/4/1 9:42:341565 閱讀
dim driverName,chs
dim conn2,sqlasd,rsasd
driverName="driver={MySQL ODBC Driver ***①};server=localhost;database=hekeet;uid=hekee;pwd=這里是數(shù)據(jù)庫密碼;"
set conn2=server.createobject("adodb.connection")
conn2.open driverName
set chs=conn2.Execute("SET NAMES 'gb2312'") ②
sqlasd = "SELECT * FROM wp_posts where post_type=0 and post_status='publish' order by id desc LIMIT 0,1③"
Set rsasd = conn2.Execute(sqlasd)
if not rsasd.bof then
do while not rsasd.eof
response.write "
< a href="/ziliao/index.php/"&rsasd("post_name")&"" data-ke-src="/ziliao/index.php/"&rsasd("post_name")&"">"&rsasd("post_title")&"
"
rsasd.movenext
loop
3:mysql沒有top X 語法 LIMIT 功能貌似更強(qiáng)大 0,1 從第幾條開始讀幾條
driverName="driver={MySQL ODBC Driver};server=localhost;database=*;uid=*;pwd=*;OPTION=3;stmt=SET NAMES GB2312"
set conn2=server.createobject("adodb.connection")
conn2.open driverName
另外一種輸出漢字防止亂碼的鏈接方法,關(guān)鍵在:"OPTION=3;stmt=SET NAMES GB2312"
微信小程序
掃描手機(jī)瀏覽