日期:2014-05-19  浏览次数:20755 次

内个。。。我写了个函数,不知道咋错了,能帮看不?谢谢那!
函数是:
  private   static   string   getstr(string   str,   string   partyp,   string   flg)
        {
                string   connectionString   =   ConfigurationManager.ConnectionStrings[ "ConnectionString "].ConnectionString;//得到配置节
                SqlConnection   DBConnection   =   new   SqlConnection(connectionString);//创建连接
                DBConnection.Open();

                char[]   delimiterChars   =   {   ', '   };
                string[]   strs   =   str.Split(delimiterChars);//数组存结果
                string   devstring   =   " ";
                string   result   =   " ";

                for   (int   j   =   0;   j   <   strs.Length;   j++)
                {
                        if   (strs[j]   !=   " ")
                        {
                                string   strstr   =   "select   para_drpt   from   sysconf   where   para_typ= ' "   +   partyp   +   " '   and   para_cd= ' "   +   strs[j]   +   " ' ";
                                if   (flg   ==   "ss "   ||   flg   ==   "H6 ")
                                {
                                        strstr   +=   " '   and   subcd_flg= ' "   +   flg   +   " ' ";
                                }
                                SqlCommand   strcmd   =   new   SqlCommand(strstr,   DBConnection);
                                SqlDataReader   strdr   =   strcmd.ExecuteReader();

                                while   (strdr.Read())
                                {
                                        devstring   =   strdr.GetValue(strdr.GetOrdinal( "para_drpt ")).ToString(