标签:style blog class code java tar
using System.Data; using System.Data.Sql; using System.Data.SqlClient; protected void Page_Load(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(@"server=HP\MYSQL;uid=sa;pwd=123456;database=Book_Management_System;timeout=10"); //无密码验证模式的ConnectString为(server=HP\\SQLEXPRESS;database=binguan;Integrated Security=SSPI;timeout=5) try { conn.Open(); //打开连接 } catch (SqlException E) { (Master.FindControl("ErrorDisplay") as Label).Text = E.Message.ToString(); //将错误显示在ErrorDisplay这个Label控件中 } finally { conn.Close(); //关闭数据库连接 } }
标签:style blog class code java tar
原文地址:http://www.cnblogs.com/Chump-Monkey/p/3716219.html