asp连接mysql程序代码

时间:2021-04-16

  asp连接mysql程序代码如下:

<%
mysql_db_name = "mysql"
mysql_db_user = "root"
mysql_db_password = ""
mysql_db_host = "localhost"
mysql_dsn="tideinfo"

strconnection="dsn="&mysql_dsn&";driver={mysql odbc 3.51 driver};server="&mysql_db_host&";uid=root;pwd=;database=mysql"
set conn = server.createobject("adodb.connection")
conn.open strconnection

'sql="create database "&mysql_db_name
'rs =conn.execute(sql)

'sql="grant select,update,insert,delete on "&mysql_db_name&".* to "&mysql_db_user&"@"&mysql_db_host&" identified by '"&mysql_db_password&"'"
sql="select * from user"
set rs = conn.execute(sql)
do while not rs.eof
response.write "mysql user"+rs("user")
rs.movenext
loop
'conn.execute(sql)
conn.close
set conn = nothing
set rs = nothing
%>

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章