Response.Redirect跳转读取数据库的网址
protected void Page_Load(object sender, EventArgs e)
{
form1.Target = "_blank";
}
protected void LinkButton3_Click(object sender, EventArgs e)
{
SqlConnection oc = new SqlConnection(ConfigurationManager.AppSettings["long"]);
oc.Open();
string sql = "select * from url where type='指纹系统'";
SqlCommand cmd = new SqlCommand(sql, oc);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
string url = dr["weburl"].ToString();
Response.Redirect(url);
// Response.Write(" <script language= 'javascript '> window.open('url') </script> ");
}
else
{
Response.Write("<script>alert('没有查到')</script>");
}
oc.Close();
}
protected void LinkButton4_Click(object sender, EventArgs e)
{
SqlConnection oc = new SqlConnection(ConfigurationManager.AppSettings["long"]);
oc.Open();
string sql = "select * from url where type='远程监控'";
SqlCommand cmd = new SqlCommand(sql, oc);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
string url = dr["weburl"].ToString();
Response.Redirect(url);
}
else
{
Response.Write("<script>alert('没有查到')</script>");
}
oc.Close();
}