日期:2013-09-18  浏览次数:20482 次

using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;


namespace cj168.DataAccess
{
    
    public class MagsDB
    {
        //SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);

        public void openConn()
        {
            //myConnection.Open();
    
        }
        

        public void closeConn()
        {
            
            //myConnection.Close();
    
            
        }


        public SqlDataReader GetMagIssue(int magID, int magYear)
        {
            SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
            
            SqlCommand myCommand = new SqlCommand("GetMagIssue", myConnection);
            myCommand.CommandType = CommandType.StoredProcedure;


            SqlParameter parameterMagID = new SqlParameter("@MagID", SqlDbType.Int, 4);
            parameterMagID.Value = magID;
            myCommand.Parameters.Add(parameterMagID);


            SqlParameter parameterMagYear = new SqlParameter("@MagYear", SqlDbType.Int, 4);
            parameterMagYear.Value = magYear;
            myCommand.Parameters.Add(parameterMagYear);

            
            myConnection.Open();
            SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
            //SqlDataReader result = myCommand.ExecuteReader();
            
            
            return result;
        }

        public DataSet GetMagIssueCat(int magID, int magYear, int yearIssue)
        {
            SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
         &nbs