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

数据库中的数据更新不了 求帮助
for (int i = 1; i < 17; i++)
            {
                SqlCommand command1 = new SqlCommand("select * from dbo.localization where  SensorNumber = " & i & " ", conn);
                SqlDataReader drl = command1.ExecuteReader();
                //while (drl.Read())
                 drl.Read();
                    double d1, d2, d3, d4;
                    double x, y;
                    x = 0;
                    y = 0;
                    int d = 40;
                    int D = 30;
                    //sensorN = int.Parse(drl["SensorNumber"].ToString());
                    //int N = Convert.ToInt16(drl["SensorNumber"]);
                    if ((!drl["RSSI1"].Equals(DBNull.Value)) && (!drl["RSSI2"].Equals(DBNull.Value)))
                    {
                        d1 = Convert.ToDouble(drl["RSSI1"]);
                        d2 = Convert.ToDouble(drl["RSSI2"]);
                        double cosB = (d1 * d1 + d * d - d2 * d2) / 2 * d1 * d;
                        double sinB = Math.Sqrt(1 - cosB * cosB);
                        x = cosB * d1;
                        y = sinB * d1;
                        //x=1;y=2;