sqlserver帮助类的使用

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Common;
namespace WebApplication5
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{


SqlParameter[] paras = new SqlParameter[] {
new SqlParameter("@id",1)
};
DataSet dt = SQLHelper.ExcuteDataSet("select * from [orderinfo] where id=@id", paras);
}
}
}

 

web.config配置

<connectionStrings>
<!--<add name="connStr" connectionString="data source=127.0.0.1;uid=root;pwd=123456;database=wgh_school;Charset=utf8" />-->
<add name="connStr" connectionString="user id=sa;password=123456;initial catalog=fjlc.shopping;data source=LAPTOP-MD433D0P\WUGONGH" />
</connectionStrings>

上一篇:SQL这样干,你就是给自己刨坑.....


下一篇:ado.net 调用存储过程