三层架构:Helper层
Posted mvpbest
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了三层架构:Helper层相关的知识,希望对你有一定的参考价值。
三层架构:Helper层
public int count(string sql) { SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=DB_class;User ID=sa;Pwd=123;"); conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); int num = (int)cmd.ExecuteScalar(); conn.Close(); return num; } public int count1(string sql) { SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=DB_class;User ID=sa;Pwd=123;"); conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); int i = cmd.ExecuteNonQuery(); conn.Close(); return i; } public DataTable count2(string sql) { SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=DB_class;User ID=sa;Pwd=123;"); conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); SqlDataAdapter dr = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); dr.Fill(ds, "shopping"); DataTable dt = ds.Tables["shopping"]; return dt; }
以上是关于三层架构:Helper层的主要内容,如果未能解决你的问题,请参考以下文章