//写入kml文件信息 public void WriteKml(KmlFile kmlFile) { Int16 i, j; dbFileConnection.Open(); cmd = dbFileConnection.CreateCommand(); trans = dbFileConnection.BeginTransaction(); kmlFile.KmlRead(); try { //写入KMLText表 foreach (DotData dotData in kmlFile.DotDataList) { cmd.CommandText = "INSERT INTO KMLText VALUES " + "(" + "'" + dotData.Coordinate.Longitude + "', " + "'" + dotData.Coordinate.Latitude + "', " + "'" + dotData.Content + "'" + ")"; cmd.ExecuteNonQuery(); } //写入KMLPoly表 i = 0; foreach (KmlParser.PolyData polyData in kmlFile.PolyDataList) { j = 0; foreach (Coordinate coordinate in polyData.CoordinateList) { cmd.CommandText = "INSERT INTO KMLPoly VALUES " + "(" + "'" + i + "', " + "'" + j + "', " + "'" + coordinate.Longitude + "', " + "'" + coordinate.Latitude + "', " + "'" + polyData.Content + "'" + ")"; cmd.ExecuteNonQuery(); j++; } i++; } trans.Commit(); } catch (Exception e) { trans.Rollback(); } cmd.Dispose(); dbFileConnection.Close(); }