日期:2014-05-17 浏览次数:20562 次
namespace DAL { public class DBConnection { SqlConnection conn = new SqlConnection("连接"); /// <summary> /// 执行一条查SQL语句,并返回ds /// </summary> /// <param name="strSql"></param> /// <returns></returns> public string strss(string strSql) { try { conn.Open(); SqlCommand cmd = new SqlCommand(strSql, conn); string strsl = cmd.ExecuteScalar().ToString(); return strsl; } catch (Exception e) { throw e; } finally { conn.Close(); } }