Hi AllBellow is a python script originated from a model and modified by me for certain needs.This code is applied to data elements (i.e. tables /feature classes) stored within perssonal SDE environment, built on top of SQL Server Express (2008). The ArcGIS version is 9.3.1, with the default python installation.When executing the script I keep getting the following error:<class 'arcgisscripting.ExecuteError'>: ERROR 000358: Invalid expressionFailed to execute (SelectLayerByAttribute).Here is the relevant part of the code that might cause that problem:tblrows = gp.searchcursor (Table_View)
tblrow = tblrows.next()
while tblrows:
myDate = tblrow.getvalue ("Date")
LineNo = tblrow.getvalue ("route_No")
FromStation = tblrow.getvalue ("From_place")
ToStation = tblrow.getvalue ("To_place")
Status = 1 #tblrow.getvalue ("Status")
phrase1 = "\"Line_No\" =" + str(LineNo) + " AND \"Station_No\" > " + str(FromStation)
phrase2 = "\"To_Station\" <=" + str(ToStation)
# Process: = Line_No and > FromStation...
gp.SelectLayerByAttribute_management(Demining_Layer, "NEW_SELECTION", phrase1)
# Process: <= ToStation...
gp.SelectLayerByAttribute_management(Flags_Layer, "SUBSET_SELECTION", phrase2)
# Process: Update Visit Date...
gp.CalculateField_management(Station_to_be_Updated, "Visit_Date", myDate, "VB", "")
# Process: Update Status...
gp.CalculateField_management(Flags_Layer__3_, "Status", str(Status), "VB", "")
myDate = ""
LineNo = ""
FromStation = ""
ToStation = ""
Status = ""
tblrow = tblrows.next ()
del tblrow
del tblrows
I guess it's got something to do with the way I'm transfering the sql phrase to the SelectByAttribute tools, but I can't put my finger at the exact spot.Any help will be appreciatedThanks in advanceGal