예제 #1
0
 public static DataTable GetTable(string strsql)
 {
     using (SqlConnection conn = new SqlConnection(strconn))
     {
         var            dt   = new DataTable();
         SqlDataAdapter msda = new SqlDataAdapter(strsql, conn);
         msda.Fill(dt);
         return(dt);
     }
 }
예제 #2
0
 public static DataTable GetTable_Proc(string pname, SqlParameter[] paras = null)
 {
     using (SqlConnection conn = new SqlConnection(strconn))
     {
         var        dt   = new DataTable();
         SqlCommand comm = new SqlCommand(pname, conn);
         comm.CommandType = CommandType.StoredProcedure;
         if (paras != null)
         {
             comm.Parameters.AddRange(paras);
         }
         SqlDataAdapter msda = new SqlDataAdapter(comm);
         msda.Fill(dt);
         return(dt);
     }
 }