query string in classic asp code to catch integer values

pablokangaroo

New Member
I have written below code piece that is supposed to search from DB based on two Parameters [*]Integer value(ID of a SHIP) [*]String value(SHIP name).But with the following code I am able to get data from the DB using the SHIP name i.e using the 2nd case. But unable to search the data using the ID of the SHIP.Following is the code snippet. Any help on these is highly appreciated.\[code\]nIMO = sql_ship_friendly(request.querystring("nIMO"))if IsNumeric(nIMO) = false then nIMO = ""else nIMO = cInt(nIMO)end ifsVessel = sql_ship_friendly(UCase(request.querystring("sVessel")),10)if not nIMO = "" then 'search based on vessel idsql = "SELECT IMO_NBR, VESSEL_NM, COALESCE(SHIP_TYP,'0') AS SHIP_TYP, COALESCE(DWT_WT, 0) AS DWT_WT, COALESCE(YEAR_BUILT_NBR, 0) AS YEAR_BUILT_NBR FROM RSP_VESSEL_VW WHERE ACTIVE_IND='Y' AND IMO_NBR = 7723948" Set db1 = Server.CreateObject("ADODB.Connection") db1.Open GV_VIEW_DB_String Set rs = db1.Execute(sql) Set dbl = nothing "elseif not sVessel = "" then 'search based on vessel numbersql = "SELECT IMO_NBR, VESSEL_NM, COALESCE(SHIP_TYP,'0') AS SHIP_TYP, COALESCE(DWT_WT, 0) AS DWT_WT, COALESCE(YEAR_BUILT_NBR , 0) AS YEAR_BUILT_NBR FROM RSP_VESSEL_VW WHERE VESSEL_NM LIKE '"&SVESSEL&"%' AND ACTIVE_IND='Y'"\[/code\]\[quote\] ' response.write sql Set db1 = Server.CreateObject("ADODB.Connection") db1.Open GV_VIEW_DB_String Set rs = db1.Execute(sql) Set dbl = nothing\[/quote\]
 
Top