Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/07/2006, 15:59
luisayre
 
Fecha de Ingreso: junio-2006
Mensajes: 61
Antigüedad: 17 años, 11 meses
Puntos: 0
>>Consulta BD ORacle no funciona el like %%

Hola, hice una consulta que corre en .net y funcionaba bien me empezó a dar error por poner la consulta usando &_
por ejemplo :

" select * " &_
" from tabla "&_
" where campo=1"

borro el símbolo &_ y funciona, luego utilice lo siguiente para que funcione

sql = " select * "
sql = sql & " from tabla "&_
sql = sql & " where campo=1"

funcionaba pero ahora mi consulta tiene lo siguiente

sub Page_Load

dim dbconn,sql,dbcomm,dbread
dim voluble2=session("nroorden1")
dim voluble3=session("nroorden2")
dim voluble5=session("fecha1")
dim voluble4=session("fecha2")
dim voluble0=session("jdf")
dbconn=New OleDbConnection("Provider=MSDAORA;Data Source=bdbaan.world;User ID=aasd; Password=vdfbfs;")
dbconn.Open()


sql= " select decode(f.t$prec$d,'9999',t$prep$d,decode(f.t$prep$ d,0,substr(f.t$refr,8,4),f.t$prep$d)) prep, "
sql = sql & "t$docd fecha,c.t$nama cliente, abs(f.t$amth$1) soles, abs(f.t$amth$2) dolares,' ' "
sql = sql & " vendedor, 0 OV, 0 cantidad, ' ' caja, 0 precio "
sql = sql & " from ttfacr200001 f, ttccom010001 c "
sql = sql & " WHERE f.t$trec IN (1, 4) "
sql = sql & " and f.t$ttyp='V03' "
sql = sql & " and f.t$orno not like '8%' "
sql = sql & " and f.t$tdoc = rpad(' ',3) "
sql = sql & " and f.t$cuno=c.t$cuno "
sql = sql & " and f.t$docd between to_date('"+voluble5+"','ddmmyyyy') and to_date('"+voluble4+"','ddmmyyyy') "
sql = sql & " and t$prec$d not like '9%' "
sql = sql & " and f.t$prep$d not in ( select "
sql = sql & " decode(f.t$prec$d,'9999',t$prep$d,decode(f.t$prep$ d,0,substr(f.t$refr,8,4),f.t$prep$d)) prep "
sql = sql & " from ttfacr200001 f, ttccom010001 c, ttdsls041001 y, ttdsls040001 u, ttccom001001 ve "
sql = sql & " WHERE f.t$trec IN (1, 4) "
sql = sql & " and f.t$ttyp='V03' "
sql = sql & " and f.t$orno not like '8%' "
sql = sql & " and f.t$tdoc = rpad(' ',3) "
sql = sql & " and f.t$cuno=c.t$cuno "
sql = sql & " and y.t$cuno=f.t$cuno "
sql = sql & " and u.t$orno = y.t$orno "
sql = sql & " and u.t$crep=ve.t$emno "
sql = sql & " and y.t$cuno like '%"+voluble0+"%' "
sql = sql & " and y.t$orno>="+voluble2+" and y.t$orno<="+voluble3+" "
sql = sql & " and f.t$docd between to_date('"+voluble5+"','ddmmyyyy') and to_date('"+voluble4+"','ddmmyyyy') "
sql = sql & " and f.t$prec$d not like '9%' "
sql = sql & " and y.t$orno like '9%' "
sql = sql & " and round((y.t$amta)*1.19,2)=(f.t$amth$2) ) "
sql = sql & " union "
sql = sql & " select "
sql = sql & " decode(f.t$prec$d,'9999',t$prep$d,decode(f.t$prep$ d,0,substr(f.t$refr,8,4),f.t$prep$d)) prep, "
sql = sql & " t$docd fecha,c.t$nama cliente, abs(f.t$amth$1) soles,abs(f.t$amth$2) dolares,ve.t$nama vendedor,y.t$orno OV, abs(y.t$dqua) cantidad, y.t$item caja, y.t$pric precio "
sql = sql & " from ttfacr200001 f, ttccom010001 c, ttdsls041001 y, ttdsls040001 u, ttccom001001 ve "
sql = sql & " WHERE f.t$trec IN (1, 4) "
sql = sql & " and f.t$ttyp='V03' "
sql = sql & " and f.t$orno not like '8%' "
sql = sql & " and f.t$tdoc = rpad(' ',3) "
sql = sql & " and f.t$cuno=c.t$cuno "
sql = sql & " and y.t$cuno=f.t$cuno "
sql = sql & " and u.t$orno = y.t$orno "
sql = sql & " and u.t$crep=ve.t$emno "
sql = sql & " and f.t$docd between to_date('"+voluble5+"','ddmmyyyy') and to_date('"+voluble4+"','ddmmyyyy') "
sql = sql & " and f.t$prec$d not like '9%' "
sql = sql & " and y.t$orno like '9%' "
sql = sql & " and round((y.t$amta)*1.19,2)=(f.t$amth$2) "
sql = sql & " and y.t$cuno like '%"+voluble0+"%' "
sql = sql & " and y.t$orno>="+voluble2+" and y.t$orno<="+voluble3+" "
sql = sql & " order by prep desc "

dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()

dbread.Close()
dbconn.Close()

end sub