请手工在PHP的目录里查找 libmysql.dll 文件,并把相关文件放到 D盾_Webshell查杀的目录下,此方法也可以用于 D盾_iis防火墙 中!
将 MySql.Data.dll 放在网站根目录 bin文件夹下面然后将这段代码贴在 default.aspx 文件中
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" %>
<%@ Import NameSpace="System.Data"%>
<%@ Import NameSpace="MySql.Data.MySqlClient"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" />
<title></title>
<script language="c#" runat="server">
protected void Page_Load(object sender,EventArgs e){
string constr = "server=localhostuid=rootpassword=rootdatabase=mydb"
string sql = "select * from product"
MySqlConnection conn = new MySqlConnection(constr)
conn.Open()
MySqlDataAdapter adp = new MySqlDataAdapter()
adp.SelectCommand = new MySqlCommand(sql,conn)
DataSet ds = new DataSet()
adp.Fill(ds)
GridView1.DataSource = ds
GridView1.DataBind()
conn.Close()
}
</script>
</head>
<body>
<asp:DataGrid ID="GridView1" runat="server"></asp:DataGrid>
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)