日期:2014-05-17  浏览次数:20906 次

C# 对象不能从 DBNull 转换为其他类型
foreach (DataRow dr in dtData.Rows)     //遍历行 in 行的集合
                    {
                        byte[] EDS = new byte[183];
                        EDS[0] = 0x82;  // emm table id
                        EDS[1] = 0x40;   // 
                        EDS[2] = 0x3f;
                        EDS[3] = 0x02;// emm secton length
                        byte[] groupid = HexStrToHexBytes(dr["Group_name"].ToString());
                        EDS[4] = groupid[0];
                        EDS[5] = groupid[1];
                        // emm secton length
                        //发送emm

                       
                       
                        string strConn = "Data Source=127.0.0.1;Initial Catalog=yz;User ID=sa;Password=sa123456";
                        SqlConnection ConnAcc = new SqlConnection(strConn);
                        string strSQL = "SELECT SGK FROM Group_SGK3 ";
                        SqlDataAdapter de = new SqlDataAdapter(strSQL, ConnMdb);
                        try
                        {
                            //da.Fill(dt);