日期:2014-05-18 浏览次数:20447 次
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.Threading; /// <summary> /// database 的摘要说明 /// </summary> public class database { public database() { // // TODO: 在此处添加构造函数逻辑 // } public string MassageBox(string TxtMassage) { string str; str = "<script language=javascript>alert('" + TxtMassage + "')</script>"; return str; } public Boolean Exect(string sQueryString) { SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conStr"]); conn.Open(); SqlCommand cmd = new SqlCommand(sQueryString, conn); try { cmd.ExecuteNonQuery(); conn.Close(); } catch (System.Exception e) { conn.Close(); return false; } return true; } public System.Data.DataSet GetDataSet(string sQueryString, string TableName) { SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conStr"]); conn.Open(); SqlDataAdapter dbAdapter = new SqlDataAdapter(sQueryString, conn); DataSet ds = new DataSet(); dbAdapter.Fill(ds, TableName); conn.Close(); return ds; } }