示例#1
0
        public static DataTable Exec_SCMSelect(string Proc_Name, string Para_Name, string Valu_Data)
        {
            string[] Arry_Para;
            string[] Arry_Valu;

            System.Data.DataTable dtData = new System.Data.DataTable();

            Arry_Para = Para_Name.Split('^');
            Arry_Valu = Valu_Data.Split('^');

            try
            {
                if (Arry_Para.Length == Arry_Valu.Length)
                {
                    CM_OLE.SCMCreateConnection();
                    SqlCommand scData = new SqlCommand(Proc_Name, CM_OLE._SCMconn);
                    scData.CommandType    = CommandType.StoredProcedure;
                    scData.CommandTimeout = Convert.ToInt32(1000);

                    for (int arrCnt = 0; arrCnt < Arry_Para.Length; arrCnt++)
                    {
                        scData.Parameters.Add("@" + Arry_Para[arrCnt].Trim(), Arry_Valu[arrCnt].Trim());
                    }

                    SqlDataAdapter adtData = new SqlDataAdapter(scData);

                    CM_OLE._SCMconn.Open();
                    adtData.Fill(dtData);
                    CM_OLE._SCMconn.Close();
                }
                else
                {
                    DataRow drData = dtData.NewRow();
                    dtData.Rows.Add(drData);
                }
            }
            catch (Exception Ex)
            {
                CM_OLE._SCMconn.Close();

                MessageBox.Show(Ex.Message.ToString());

                DataRow drData = dtData.NewRow();
                dtData.Rows.Add(drData);
            }
            return(dtData);
        }
示例#2
0
        public static SqlDataAdapter Exec_SCMDataAdapter(string Proc_Name, string Para_Name, string Valu_Data)
        {
            string[] Arry_Para;
            string[] Arry_Valu;

            Arry_Para = Para_Name.Split('^');
            Arry_Valu = Valu_Data.Split('^');

            CM_OLE.SCMCreateConnection();
            SqlCommand scData = new SqlCommand(Proc_Name, CM_OLE._SCMconn);

            scData.CommandType    = CommandType.StoredProcedure;
            scData.CommandTimeout = Convert.ToInt32(1000);

            for (int arrCnt = 0; arrCnt < Arry_Para.Length; arrCnt++)
            {
                scData.Parameters.Add("@" + Arry_Para[arrCnt].Trim(), Arry_Valu[arrCnt].Trim());
            }

            SqlDataAdapter adtData = new SqlDataAdapter(scData);

            return(adtData);
        }