using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;namespace Test
{
public partial class Demo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Data Source=.;Initial Catalog=CRM;Integrated Security=True";
conn.Open(); SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select * from dept;";
cmd.CommandType = CommandType.Text;
cmd.Connection = conn;
conn.Close();
Response.Write("<script> alert('链接成功!') </script>");
}
catch
{
Response.Write("<script> alert('链接失败!') </script>");
}
} protected void BtnLogin_Click(object sender, EventArgs e)
{
} }
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;namespace Test
{
public partial class Demo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Data Source=.;Initial Catalog=CRM;Integrated Security=True";
conn.Open(); SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select * from dept;";
cmd.CommandType = CommandType.Text;
cmd.Connection = conn;
conn.Close();
Response.Write("<script> alert('链接成功!') </script>");
}
catch
{
Response.Write("<script> alert('链接失败!') </script>");
}
} protected void BtnLogin_Click(object sender, EventArgs e)
{
} }
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货