MySQL Forums
Forum List  »  Spanish

Re: errores al exportar datos numericos a txt
Posted by: dolors pastor
Date: November 17, 2010 06:44AM

Es un script visual basic, y en los campos no hay valores nulos cuando da ese error son enteros > 100. no logro entenderlo
Te lo paso

Set objFSO = CreateObject("Scripting.FileSystemObject") 'create and open text file
Set objOutFile = objFSO.OpenTextFile("C:\pedido.txt", 2, True)


set ad = CreateObject("ADODB.Connection") 'create and open ODBC connection
ad.ConnectionString= "DSN=scma"
ad.Open
' borra del temporal los ped que ya existen
sql_query = _
"delete from temp_pedido " & _
"using temp_pedido,pedidos " & _
"where pedidos.numeropedido=temp_pedido.numeropedido " & _
" and pedidos.fecha=temp_pedido.fecha " & _
" and pedidos.oiddestino=temp_pedido.oiddestino " & _
" and pedidos.oidproveedor=temp_pedido.oidproveedor " & _
" and pedidos.oidproducto=temp_pedido.oidproducto " & _
" and pedidos.oidstock=temp_pedido.oidstock " & _
" and pedidos.oidpedidoexport=temp_pedido.oidpedidoexport"
Set rs = ad.execute(sql_query) 'execute query

sql_query = _
"select numeropedido,tipopedido,fecha,oiddestino,destino,oidpais,pais,ped.oidproveedor," & _
" ped.proveedor,oidstock,stock,oidproducto,productolargo,producto,cajaspedido, "& _
" confeccion,calibre,marca,npiezas,

replace(cast(pesoconfeccion as char),'.',','),

cajasxpalet,gama,ped.plataformaorigen,oidpedidoexport, " & _
" pr.oidzona,z.zona "& _
" from temp_pedido ped " & _
" left join proveedor pr on pr.oidproveedor=ped.oidproveedor "& _
" left join zona z on z.oidzona=pr.oidzona "
Set rs = ad.execute(sql_query) 'execute query


on error resume next
intCount = rs.Fields.Count - 1
do while not rs.eof 'loop to cycle through the table
tmpString = Null
for i = 0 to intCount
tmpString = rs.fields.item(i) & vbTab
if isnull(tmpString) then tmpString = vbTab
objOutFile.Write tmpString
tmpstring = Null
next
objOutFile.WriteLine 'newline
rs.MoveNext
loop
ad.close

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: errores al exportar datos numericos a txt
1323
November 17, 2010 06:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.