Hi All
I am trying to display the positions of three vehicles on a markers
layer. The positions are stored in an SQL Server database and the page is an
aspx page. The code below works okay on IE9 but not on anything else. Can
anyone point me in the right direction to get this working on most browsers. I
am fairly new to javascript and aspx and so any help will be appreciated.
====
function updatevehicles()
{
vehiclePositions.clearMarkers;
var currentvehiclePosition;
var ConnDB = new ActiveXObject("ADODB.Connection");
ConnDB.ConnectionString = "Provider=SQLOLEDB.1;Integrated
Security=SSPI; PersistSecurity Info=False;Initial Catalog=xxxx;Data Source=yyy";
ConnDB.Open();
var Rs = new ActiveXObject("ADODB.Recordset");
Rs.Open("SELECT DISTINCT [UnitID], [Latitude], [Longitude],
[Icon], [Colour] FROM [Position] ORDER BY [UnitID]", ConnDB);
Rs.MoveFirst;
var vehiclenum;
vehiclenum = 1;
while (!Rs.EOF) {
currentvehiclePosition = new
OpenLayers.LonLat(Rs.Fields.Item("Longitude"),
Rs.Fields.Item("Latitude")).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject());
if (vehiclenum === 1) {
vehicleMarker1 = new
OpenLayers.Marker(currentvehiclePosition, icon1);
vehiclePositions.addMarker(vehicleMarker1);
vehiclePositions.drawMarker(vehicleMarker1);
}
if (vehiclenum === 2) {
vehicleMarker2 = new
OpenLayers.Marker(currentvehiclePosition, icon2);
vehiclePositions.addMarker(vehicleMarker2);
vehiclePositions.drawMarker(vehicleMarker2);
}
if (vehiclenum === 3) {
vehicleMarker3 = new
OpenLayers.Marker(currentvehiclePosition, icon3);
vehiclePositions.addMarker(vehicleMarker3);
vehiclePositions.drawMarker(vehicleMarker3);
}
vehiclenum++;
Rs.MoveNext;
}
}
====
Graham Wade
Graham Wade
Managing Director
Phone: 01420 550 290 Ext 200
Fax : 01420 550291
CORALSys Limited.
Trading address: Blacknest House, Blacknest Road, Blacknest, Alton, Hants, GU34
4PX
Registered office: Walnut House, Walnut Court, Rose Street, Wokingham, RG40 1XU
CORALSys is a limited company registered in England and Wales.
Registered number: 3106888.
Please note that CORALSys may monitor email traffic data and also the content
of email for the purposes of security and staff training.
Please note that any views or opinions presented in this email are solely those
of the author and do not necessarily represent those of the company.
The content of this e-mail (including any attachments) is strictly confidential
and may be commercially sensitive. If you are not, or believe you may not be,
the intended recipient, please advise the sender immediately by return e-mail,
delete this e-mail and destroy any copies.
WARNING: Computer viruses can be transmitted via email. The recipient should
check this email and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted by this
email. E-mail transmission cannot be guaranteed to be secure or error-free as
information could be intercepted, corrupted, lost, destroyed, arrive late or
incomplete, or contain viruses. The sender therefore does not accept liability
for any errors or omissions in the contents of this message, which arise as a
result of e-mail transmission.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users