Too few parameters

16/12/2004 - 00:45 por Rookie | Informe spam
Intento insertar en una tabla, datos procedentes de dos tablas, este es mi
procedimiento:

Set mdbconn = Server.CreateObject("ADODB.CONNECTION")
mdbconn.Open = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=C:\Projects\Symbol\Base.mdb"
'mdbconn.Open = "DRIVER={Microsoft Access Driver (*.mdb)};"DBQ=" &
server.mappath("Base.mdb")"
Set rsaccess = Server.CreateObject("ADODB.Recordset")
rsaccess.LockType = 3
sqlaccess = "select * from Pedido_Header2 where idNum= " &
Request.QueryString("Pedido_id")
rsaccess.Open sqlaccess, mdbconn

'Coneccion para totales

'Set mdbconn4 = Server.CreateObject("ADODB.CONNECTION")
'mdbconn4.Open = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=C:\Projects\Symbol\Base.mdb"
'mdbconn.Open = "DRIVER={Microsoft Access Driver (*.mdb)};"DBQ=" &
server.mappath("Base.mdb")"
Set rsaccess4 = Server.CreateObject("ADODB.Recordset")
rsaccess4.LockType = 3
'obtengo los valores de Total Bruto, IVA y Total NETO
sqlaccess4 = "select SUM(prec_vta * total_art) AS reng_bruto, SUM(prec_vta *
total_art * 0.05) AS itbm, SUM(prec_vta * total_art + prec_vta * total_art *
0.05) AS reng_neto from Reng_Ped2b_Total where id_Temp= " &
Request.QueryString("Pedido_id")
rsaccess4.Open sqlaccess4, mdbconn
'ahora esta abierta la coneccion a la access db y abres la coneccion a la
'foxpro

Set conn = Server.CreateObject("ADODB.Connection")
conn.open "DSN=DataProfit","UID=;","Pwd=;"

'pasas los valores de la access recordset a variables

Dim LastID
Dim v_fact_num
Dim LastID2
LastID = CCDLookup("max(Fact_Num)","Pedidos","",DBConnection3)
v_fact_num = LastID + 1
LastID2 = LastID + 1

v_status= Trim(rsaccess.fields("status"))
v_co_cli= Trim(rsaccess.fields("co_cli"))
v_co_tran= Trim(rsaccess.fields("co_tran"))
v_forma_pag= Trim(rsaccess.fields("forma_pag"))
v_co_sucu= Trim(rsaccess.fields("co_sucu"))
v_fec_emis= Trim(rsaccess.fields("fec_emis"))
v_co_ven= Trim(rsaccess.fields("co_ven"))
v_feccom= Trim(rsaccess.fields("fec_emis"))
'v_numcom= 0
v_moneda= Trim(rsaccess.fields("moneda"))
v_tasa= Trim(rsaccess.fields("tasa"))
'v_tasa= 1

' Debug de _Variables
'response.write v_fact_num
'response.write v_status
'response.write v_co_cli
'response.write v_co_tran
'response.write v_forma_pag
'response.write v_co_sucu
'response.write v_numcom
'response.write v_tasa
'response.write v_co_ven


'aca llamo los valores del sub-total(bruto), iva y total neto
v_Total_bruto = Trim(rsaccess4.fields("reng_bruto"))
v_Total_neto = Trim(rsaccess4.fields("reng_neto"))
v_iva = Trim(rsaccess4.fields("itbm"))
Dim v_tasa5
Dim v_tasa10
v_tasa5 = 5
v_tasa10 = 5
'sqlfoxpro4 = "insert into Pedidos() values ()"
'conn4.Execute sqlfoxpro4
'sqlfoxpro = "insert into Pedidos(fact_num, status, co_cli, co_tran,
forma_pag, co_sucu) values ("&v_fact_num&", '"&v_status&"', '"&v_co_cli&"',
'"&v_co_tran&"', '"&v_forma_pag&"', '"&v_co_sucu&"')"

'aca inserto los valores
sqlfoxpro = "insert into Pedidos(fact_num, status, co_tran, forma_pag,
co_sucu, co_ven, moneda, co_cli, tasa, Tot_bruto, Tot_neto, iva, Tasag,
tasag10) values ("&v_fact_num&", '"&v_status&"', '"&v_co_tran&"',
'"&v_forma_pag&"', '"&v_co_sucu&"', '"&v_co_ven&"', '"&v_moneda&"',
'"&v_co_cli&"', "&v_tasa&", "&v_Total_bruto&", "&v_Total_neto&", "&v_iva&",
"&v_tasa5&", "&v_tasa10&" )"
'ejecutar
conn.Execute sqlfoxpro


este es el codigo completo:

' -
Dim mdbconn
Dim rsaccess
Dim sqlaccess
Dim conn
'Dim v_fact_num
Dim v_status
Dim v_co_cli
Dim v_co_tran
Dim v_forma_pag
Dim v_co_sucu
Dim v_fec_emis
Dim v_co_ven
Dim v_feccom
Dim v_numcom
Dim v_moneda
Dim v_tasa
Dim sqlfoxpro
Dim mdbconn4
Dim rsaccess4
Dim sqlaccess4
Dim conn4



'LastID = CCDLookup("max(Fact_Num)","Pedidos","",DBConnection3)
'response.write LastID
Set mdbconn = Server.CreateObject("ADODB.CONNECTION")
mdbconn.Open = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=C:\Projects\Symbol\Base.mdb"
'mdbconn.Open = "DRIVER={Microsoft Access Driver (*.mdb)};"DBQ=" &
server.mappath("Base.mdb")"
Set rsaccess = Server.CreateObject("ADODB.Recordset")
rsaccess.LockType = 3
sqlaccess = "select * from Pedido_Header2 where idNum= " &
Request.QueryString("Pedido_id")
rsaccess.Open sqlaccess, mdbconn

'Coneccion para totales

'Set mdbconn4 = Server.CreateObject("ADODB.CONNECTION")
'mdbconn4.Open = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=C:\Projects\Symbol\Base.mdb"
'mdbconn.Open = "DRIVER={Microsoft Access Driver (*.mdb)};"DBQ=" &
server.mappath("Base.mdb")"
Set rsaccess4 = Server.CreateObject("ADODB.Recordset")
rsaccess4.LockType = 3
'obtengo los valores de Total Bruto, IVA y Total NETO
sqlaccess4 = "select SUM(prec_vta * total_art) AS reng_bruto, SUM(prec_vta *
total_art * 0.05) AS itbm, SUM(prec_vta * total_art + prec_vta * total_art *
0.05) AS reng_neto from Reng_Ped2b_Total where id_Temp= " &
Request.QueryString("Pedido_id")
rsaccess4.Open sqlaccess4, mdbconn
'ahora esta abierta la coneccion a la access db y abres la coneccion a la
'foxpro

Set conn = Server.CreateObject("ADODB.Connection")
conn.open "DSN=DataProfit","UID=;","Pwd=;"

'pasas los valores de la access recordset a variables

Dim LastID
Dim v_fact_num
Dim LastID2
LastID = CCDLookup("max(Fact_Num)","Pedidos","",DBConnection3)
v_fact_num = LastID + 1
LastID2 = LastID + 1

v_status= Trim(rsaccess.fields("status"))
v_co_cli= Trim(rsaccess.fields("co_cli"))
v_co_tran= Trim(rsaccess.fields("co_tran"))
v_forma_pag= Trim(rsaccess.fields("forma_pag"))
v_co_sucu= Trim(rsaccess.fields("co_sucu"))
v_fec_emis= Trim(rsaccess.fields("fec_emis"))
v_co_ven= Trim(rsaccess.fields("co_ven"))
v_feccom= Trim(rsaccess.fields("fec_emis"))
'v_numcom= 0
v_moneda= Trim(rsaccess.fields("moneda"))
v_tasa= Trim(rsaccess.fields("tasa"))
'v_tasa= 1

' Debug de _Variables
'response.write v_fact_num
'response.write v_status
'response.write v_co_cli
'response.write v_co_tran
'response.write v_forma_pag
'response.write v_co_sucu
'response.write v_numcom
'response.write v_tasa
'response.write v_co_ven


'aca llamo los valores del sub-total(bruto), iva y total neto
v_Total_bruto = Trim(rsaccess4.fields("reng_bruto"))
v_Total_neto = Trim(rsaccess4.fields("reng_neto"))
v_iva = Trim(rsaccess4.fields("itbm"))
Dim v_tasa5
Dim v_tasa10
v_tasa5 = 5
v_tasa10 = 5
'sqlfoxpro4 = "insert into Pedidos() values ()"
'conn4.Execute sqlfoxpro4
'sqlfoxpro = "insert into Pedidos(fact_num, status, co_cli, co_tran,
forma_pag, co_sucu) values ("&v_fact_num&", '"&v_status&"', '"&v_co_cli&"',
'"&v_co_tran&"', '"&v_forma_pag&"', '"&v_co_sucu&"')"

'aca inserto los valores
sqlfoxpro = "insert into Pedidos(fact_num, status, co_tran, forma_pag,
co_sucu, co_ven, moneda, co_cli, tasa, Tot_bruto, Tot_neto, iva, Tasag,
tasag10) values ("&v_fact_num&", '"&v_status&"', '"&v_co_tran&"',
'"&v_forma_pag&"', '"&v_co_sucu&"', '"&v_co_ven&"', '"&v_moneda&"',
'"&v_co_cli&"', "&v_tasa&", "&v_Total_bruto&", "&v_Total_neto&", "&v_iva&",
"&v_tasa5&", "&v_tasa10&" )"
'ejecutar
conn.Execute sqlfoxpro

'ahora borras el record de access

rsaccess.Delete

'cierrass las coneccionnes

rsaccess.Close
Set rsaccess = Nothing
mdbconn.Close
Set mdbconn = Nothing
rsaccess4.Close
Set rsaccess4 = Nothing
'mdbconn4.Close
'Set mdbconn4 = Nothing
conn.Close
Set conn = Nothing

' -
 

Leer las respuestas

#1 StressedMonkey
16/12/2004 - 01:44 | Informe spam
Rookie, es dificil saber donde ocurre el error, pudes postear tu codigo
actual denuevo, y indicar en cual linea el mensage de error indica que esta
la falla?

Sergio.


"Rookie" wrote in message
news:
Intento insertar en una tabla, datos procedentes de dos tablas, este es mi
procedimiento:

Set mdbconn = Server.CreateObject("ADODB.CONNECTION")
mdbconn.Open = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=C:\Projects\Symbol\Base.mdb"
'mdbconn.Open = "DRIVER={Microsoft Access Driver (*.mdb)};"DBQ=" &
server.mappath("Base.mdb")"
Set rsaccess = Server.CreateObject("ADODB.Recordset")
rsaccess.LockType = 3
sqlaccess = "select * from Pedido_Header2 where idNum= " &
Request.QueryString("Pedido_id")
rsaccess.Open sqlaccess, mdbconn

'Coneccion para totales

'Set mdbconn4 = Server.CreateObject("ADODB.CONNECTION")
'mdbconn4.Open = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=C:\Projects\Symbol\Base.mdb"
'mdbconn.Open = "DRIVER={Microsoft Access Driver (*.mdb)};"DBQ=" &
server.mappath("Base.mdb")"
Set rsaccess4 = Server.CreateObject("ADODB.Recordset")
rsaccess4.LockType = 3
'obtengo los valores de Total Bruto, IVA y Total NETO
sqlaccess4 = "select SUM(prec_vta * total_art) AS reng_bruto, SUM(prec_vta


*
total_art * 0.05) AS itbm, SUM(prec_vta * total_art + prec_vta * total_art


*
0.05) AS reng_neto from Reng_Ped2b_Total where id_Temp= " &
Request.QueryString("Pedido_id")
rsaccess4.Open sqlaccess4, mdbconn
'ahora esta abierta la coneccion a la access db y abres la coneccion a la
'foxpro

Set conn = Server.CreateObject("ADODB.Connection")
conn.open "DSN=DataProfit","UID=;","Pwd=;"

'pasas los valores de la access recordset a variables

Dim LastID
Dim v_fact_num
Dim LastID2
LastID = CCDLookup("max(Fact_Num)","Pedidos","",DBConnection3)
v_fact_num = LastID + 1
LastID2 = LastID + 1

v_status= Trim(rsaccess.fields("status"))
v_co_cli= Trim(rsaccess.fields("co_cli"))
v_co_tran= Trim(rsaccess.fields("co_tran"))
v_forma_pag= Trim(rsaccess.fields("forma_pag"))
v_co_sucu= Trim(rsaccess.fields("co_sucu"))
v_fec_emis= Trim(rsaccess.fields("fec_emis"))
v_co_ven= Trim(rsaccess.fields("co_ven"))
v_feccom= Trim(rsaccess.fields("fec_emis"))
'v_numcom= 0
v_moneda= Trim(rsaccess.fields("moneda"))
v_tasa= Trim(rsaccess.fields("tasa"))
'v_tasa= 1

' Debug de _Variables
'response.write v_fact_num
'response.write v_status
'response.write v_co_cli
'response.write v_co_tran
'response.write v_forma_pag
'response.write v_co_sucu
'response.write v_numcom
'response.write v_tasa
'response.write v_co_ven


'aca llamo los valores del sub-total(bruto), iva y total neto
v_Total_bruto = Trim(rsaccess4.fields("reng_bruto"))
v_Total_neto = Trim(rsaccess4.fields("reng_neto"))
v_iva = Trim(rsaccess4.fields("itbm"))
Dim v_tasa5
Dim v_tasa10
v_tasa5 = 5
v_tasa10 = 5
'sqlfoxpro4 = "insert into Pedidos() values ()"
'conn4.Execute sqlfoxpro4
'sqlfoxpro = "insert into Pedidos(fact_num, status, co_cli, co_tran,
forma_pag, co_sucu) values ("&v_fact_num&", '"&v_status&"',


'"&v_co_cli&"',
'"&v_co_tran&"', '"&v_forma_pag&"', '"&v_co_sucu&"')"

'aca inserto los valores
sqlfoxpro = "insert into Pedidos(fact_num, status, co_tran, forma_pag,
co_sucu, co_ven, moneda, co_cli, tasa, Tot_bruto, Tot_neto, iva, Tasag,
tasag10) values ("&v_fact_num&", '"&v_status&"', '"&v_co_tran&"',
'"&v_forma_pag&"', '"&v_co_sucu&"', '"&v_co_ven&"', '"&v_moneda&"',
'"&v_co_cli&"', "&v_tasa&", "&v_Total_bruto&", "&v_Total_neto&",


"&v_iva&",
"&v_tasa5&", "&v_tasa10&" )"
'ejecutar
conn.Execute sqlfoxpro


este es el codigo completo:

' -
Dim mdbconn
Dim rsaccess
Dim sqlaccess
Dim conn
'Dim v_fact_num
Dim v_status
Dim v_co_cli
Dim v_co_tran
Dim v_forma_pag
Dim v_co_sucu
Dim v_fec_emis
Dim v_co_ven
Dim v_feccom
Dim v_numcom
Dim v_moneda
Dim v_tasa
Dim sqlfoxpro
Dim mdbconn4
Dim rsaccess4
Dim sqlaccess4
Dim conn4



'LastID = CCDLookup("max(Fact_Num)","Pedidos","",DBConnection3)
'response.write LastID
Set mdbconn = Server.CreateObject("ADODB.CONNECTION")
mdbconn.Open = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=C:\Projects\Symbol\Base.mdb"
'mdbconn.Open = "DRIVER={Microsoft Access Driver (*.mdb)};"DBQ=" &
server.mappath("Base.mdb")"
Set rsaccess = Server.CreateObject("ADODB.Recordset")
rsaccess.LockType = 3
sqlaccess = "select * from Pedido_Header2 where idNum= " &
Request.QueryString("Pedido_id")
rsaccess.Open sqlaccess, mdbconn

'Coneccion para totales

'Set mdbconn4 = Server.CreateObject("ADODB.CONNECTION")
'mdbconn4.Open = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=C:\Projects\Symbol\Base.mdb"
'mdbconn.Open = "DRIVER={Microsoft Access Driver (*.mdb)};"DBQ=" &
server.mappath("Base.mdb")"
Set rsaccess4 = Server.CreateObject("ADODB.Recordset")
rsaccess4.LockType = 3
'obtengo los valores de Total Bruto, IVA y Total NETO
sqlaccess4 = "select SUM(prec_vta * total_art) AS reng_bruto, SUM(prec_vta


*
total_art * 0.05) AS itbm, SUM(prec_vta * total_art + prec_vta * total_art


*
0.05) AS reng_neto from Reng_Ped2b_Total where id_Temp= " &
Request.QueryString("Pedido_id")
rsaccess4.Open sqlaccess4, mdbconn
'ahora esta abierta la coneccion a la access db y abres la coneccion a la
'foxpro

Set conn = Server.CreateObject("ADODB.Connection")
conn.open "DSN=DataProfit","UID=;","Pwd=;"

'pasas los valores de la access recordset a variables

Dim LastID
Dim v_fact_num
Dim LastID2
LastID = CCDLookup("max(Fact_Num)","Pedidos","",DBConnection3)
v_fact_num = LastID + 1
LastID2 = LastID + 1

v_status= Trim(rsaccess.fields("status"))
v_co_cli= Trim(rsaccess.fields("co_cli"))
v_co_tran= Trim(rsaccess.fields("co_tran"))
v_forma_pag= Trim(rsaccess.fields("forma_pag"))
v_co_sucu= Trim(rsaccess.fields("co_sucu"))
v_fec_emis= Trim(rsaccess.fields("fec_emis"))
v_co_ven= Trim(rsaccess.fields("co_ven"))
v_feccom= Trim(rsaccess.fields("fec_emis"))
'v_numcom= 0
v_moneda= Trim(rsaccess.fields("moneda"))
v_tasa= Trim(rsaccess.fields("tasa"))
'v_tasa= 1

' Debug de _Variables
'response.write v_fact_num
'response.write v_status
'response.write v_co_cli
'response.write v_co_tran
'response.write v_forma_pag
'response.write v_co_sucu
'response.write v_numcom
'response.write v_tasa
'response.write v_co_ven


'aca llamo los valores del sub-total(bruto), iva y total neto
v_Total_bruto = Trim(rsaccess4.fields("reng_bruto"))
v_Total_neto = Trim(rsaccess4.fields("reng_neto"))
v_iva = Trim(rsaccess4.fields("itbm"))
Dim v_tasa5
Dim v_tasa10
v_tasa5 = 5
v_tasa10 = 5
'sqlfoxpro4 = "insert into Pedidos() values ()"
'conn4.Execute sqlfoxpro4
'sqlfoxpro = "insert into Pedidos(fact_num, status, co_cli, co_tran,
forma_pag, co_sucu) values ("&v_fact_num&", '"&v_status&"',


'"&v_co_cli&"',
'"&v_co_tran&"', '"&v_forma_pag&"', '"&v_co_sucu&"')"

'aca inserto los valores
sqlfoxpro = "insert into Pedidos(fact_num, status, co_tran, forma_pag,
co_sucu, co_ven, moneda, co_cli, tasa, Tot_bruto, Tot_neto, iva, Tasag,
tasag10) values ("&v_fact_num&", '"&v_status&"', '"&v_co_tran&"',
'"&v_forma_pag&"', '"&v_co_sucu&"', '"&v_co_ven&"', '"&v_moneda&"',
'"&v_co_cli&"', "&v_tasa&", "&v_Total_bruto&", "&v_Total_neto&",


"&v_iva&",
"&v_tasa5&", "&v_tasa10&" )"
'ejecutar
conn.Execute sqlfoxpro

'ahora borras el record de access

rsaccess.Delete

'cierrass las coneccionnes

rsaccess.Close
Set rsaccess = Nothing
mdbconn.Close
Set mdbconn = Nothing
rsaccess4.Close
Set rsaccess4 = Nothing
'mdbconn4.Close
'Set mdbconn4 = Nothing
conn.Close
Set conn = Nothing

' -

Preguntas similares