ºìÁªLinuxÃÅ»§
Linux°ïÖú

ASPÖÐʹÓÃMYSQLÊý¾Ý¿â

·¢²¼Ê±¼ä:2006-02-10 09:30:13À´Ô´:ºìÁª×÷Õß:wide
MYSQLÊý¾Ý¿âÒÔËü¶ÌС¡¢·½±ã¡¢Ëٶȿ졢Ãâ·ÑµÈÓŵã³ÉΪºÜ¶àÍøվĿǰÊ×Ñ¡Êý¾Ý¿â£¬µ«Ò»°ã¶¼ÊÇÓÃPHP+MYSQLÏà½áºÏÀ´¿ª·¢¸÷ÖÖ¶¯Ì¬Ò³Ã棬ÆäʵASPÒ²¿ÉÒÔʹÓÃMYSQLÊý¾Ý¿â¿ª·¢¶¯Ì¬Ò³Ã棬СµÜÎÒÒ²ÊǸոÕѧ»á£¬²»¸Ò¶ÀÏí£¬ËùÒÔÌØдÁËÕâƪÎÄÕ¹©´ó»ï²Î¿¼¡£

¡¡¡¡ÎҵĻ·¾³ÊÇWINDOWS98+PWS4.0+mysql-3.23.32-win+PHP4

¡¡¡¡±ØÒªµÄÈí¼þ£ºPWS4.0£¨ºÇºÇ£¬·Ï»°£©

¡¡¡¡mysql-3.23.32-win£¨Õâ¸öÊÇ×îаæµÄ£©

¡¡¡¡myodbc-2.50.36-dll£¨Õâ¸öÊÇ×îÖØÒªµÄ£¬MYSQL ODBCµÄÇý¶¯³ÌÐò£¬¿ÉÒÔµ½www.mysql.comÏÂÔØ£©

¡¡¡¡µÚÒ»²½£º°²×°MYSQL ODBDµÄÇý¶¯³ÌÐò£¬½«ÏÂÔصÄmyodbd-2.50.46-dllÎļþ¸´ÖƵ½windows\systemĿ¼ÏÂ(windows2000ÊÇwinnt/system32)È»ºó½¨Á¢Ò»ÐÂÎļþ£¬À©Õ¹ÃûΪreg£¨¾ÍÊÇ×¢²á±íÎļþ£©,½«ÒÔÏÂÄÚÈݸ´ÖƵ½¸ÃÎļþÖС£


ÒýÓÃ:
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\myodbc driver]
"UsageCount"=dword:00000002
"Driver"="C:\\WINDOWS\\System\\myodbc.dll"
"Setup"="C:\\WINDOWS\\System\\myodbc.dll"
"SQLLevel"="1"
"FileUsage"="0"
"DriverODBCVer"="02.50"
"ConnectFunctions"="YYY"
"APILevel"="1"
"CpTimeout"="120"
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers]
"myodbc driver"="installed"




¡¡¡¡±£´æºóË«»÷¸ÃÎļþ£¬½«ÉÏÃæ´úÂë×¢²áµ½WINDOWS×¢²á±íÖС£

¡¡¡¡Èç¹û°²×°ÔÚwindows2000ÖÐ,ÔòDriverºÍSetupÖ÷¼üµÄÖµÒª×öÏàÓ¦¸Ä±ä£¬ÕâÀïÎÒÏë¾Í²»Óöà˵ÁË¡£

¡¡¡¡Èç¹û³É¹¦£¬ÔÚ¿ØÖÆÃæ°å/ODBDÊý¾ÝÔ´µÄÇý¶¯³ÌÐòÀォ¿´µ½myodbd driverÕâÒ»Ï

¡¡¡¡µÚ¶þ²½£º½¨Á¢ASPÎļþÁ´½ÓÊý¾Ý¿â¡£

¡¡¡¡ÕâÀïÓÐÁ½ÖÖ·½·¨£¬Ò»ÖÖÊÇÔÚODBCÊý¾ÝÔ´Öн¨Á¢Ò»¸öϵͳDSN¡£ºóÀ´ÎÒ·¢ÏÖ²»½¨Á¢Ò²¿ÉÒÔÔÚASPÖÐʹÓÃMYSQL,·½·¨ÔÚÏÂÎĽ«½²µÀ¡£

¡¡¡¡´ò¿ª¿ØÖÆÃæ°å/ODBDÊý¾ÝÔ´£¬Ñ¡ÔñϵͳDSN,È»ºóÌí¼ÓÒ»¸öеÄDSN,Çý¶¯³ÌÐòÑ¡Ôñmyodbd driver,»á³öÏÖÒ»¸ö¶Ô»°¿ò¹©ÊäÈëmysql

¡¡¡¡Ïà¹ØÐÅÏ¢¡£

¡¡¡¡Windows DSN name: ËùÒª½¨Á¢DSNµÄÃû³Æ

¡¡¡¡Mysql Host (name or ip):Mysql·þÎñÆ÷µÄÃû³Æ»òÕßÊÇIPµØÖ·£¬Í¨³£Ìîlocalhost

¡¡¡¡Mysql database name:ÐèҪʹÓÃÊý¾Ý¿âµÄÃû³Æ£¬Êý¾Ý¿âÔÚMysql¹ÜÀí³ÌÐòÖн¨Á¢¡£ÕâÀïÎÒÃÇʹÓÃÒ»¸öÀý×Ó¡£Êý¾Ý¿âÃû£ºhc188£¬ÀïÃæÓÐÊý¾Ý±í£ºuser Êý¾Ý±íÓÐÁ½¸ö×ֶηֱðÊÇ£ºusernameºÍpassword,Ëæ±ã²åÈ뼸¸öÊý¾Ý¡£

¡¡¡¡user:Á´½ÓÊý¾Ý¿âµÄÓû§Ãû£¬ÎÒÌîµÄÊÇroot³¬¼¶Óû§

¡¡¡¡password:Á´½ÓÊý¾Ý¿âÓû§ÃÜÂ룬Èç¹ûûÓУ¬¿ÉÒÔ²»Ìî

¡¡¡¡Port(if not 3306)£ºMysqlÔÚ·þÎñÆ÷µÄ¶Ë¿Ú£¬Èç¹û²»ÌîĬÈÏΪ3306


¡¡¡¡SQL command on connect:ʹÓÃsqlÃüÁîÁ´½ÓÊý¾Ý¿â£¬ÕâÏî¿ÉÒÔ²»Ìî

¡¡¡¡ÌîдÍê±ÏºóÑ¡ÔñOK±£´æ¡£

¡¡¡¡ÏÂÃæÁ´½ÓÊý¾Ý¿âµÄASP´úÂ룡


ÒýÓÃ:
£¼%
strConnection = "dsn=hc188;driver={myodbd driver};server=localhost;uid=root;pwd=;database=hc188"
Set adoDataConn = Server.CreateObject("ADODB.Connection")
adoDataConn.Open strConnection

strQuery = "SELECT * FROM user"
Set rs = adoDataConn.Execute(strQuery)
If Not rs.BOF Then
%£¾
£¼TABLE£¾
£¼TR£¾
£¼TD£¼b£¾username£¼/b£¾£¼/TD£¾
£¼TD£¾£¼b£¾password£¼/b£¾£¼/TD£¾
£¼/TR£¾
£¼%
Do While Not rs.EOF
%£¾
£¼TR£¾
£¼TD£¾£¼%=rs("username")%£¾£¼/TD£¾
£¼TD£¾£¼%=rs("password")%£¾£¼/TD£¾
£¼/TR£¾
£¼%
rs.MoveNext
Loop
%£¾
£¼/TABLE£¾
£¼%
Else
Response.Write("Sorry, no data found.")
End If

rs.Close
adoDataConn.Close
Set adoDataConn = Nothing
Set rsEmailData = Nothing
%£¾




¡¡¡¡µÚ¶þÖÖ·½·¨£ºÎÒÔÚʹÓÃÖÐÏë¹ýÈç¹û²»½¨Á¢ÏµÍ³DSN£¬ÊÇ·ñÒ²¿ÉÒÔʹÓÃMYSQLÊý¾Ý¿âÄØ£¿½á¹ûÊÇ¿ÉÒԵġ£

¡¡¡¡·½·¨ºÜ¼òµ¥£¬°ÑÉÏÃæASP´úÂëµÚ¶þÐдúÂë¸ÄΪ£º

¡¡¡¡strconnection="DefaultDir=;Driver={myodbc driver};database=hc188"

¡¡¡¡ÎÒÆæ¹ÖµÄ·¢ÏÖ£¬ÕâÖÖ·½·¨Á¬Óû§ÃûºÍÃÜÂ붼²»ÐèÒª¾Í¿ÉÒÔʹÓá£ÊDz»ÊÇMYSQLµÄÒ»¸öBUGÄØ£¿

¡¡¡¡ÒÔÉÏ´úÂëÈ«²¿¾­²âÊÔͨ¹ý£¡

¡¡¡¡µ½´Ë£¬È«ÎĽáÊøÁË£¬ÊDz»ÊǺܼòµ¥ÄØ£¡Ï£ÍûÄÜ°ïÉÏÄ㣡

¡¡¡¡Èç¹ûÓÐÈκÎÒÉÎÊ£¬ÎÒµÄÐÅÏ䣺hc911@263.net
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ