Multiple Insert with Null Values
I have two pages: Page1.asp and page2.asp. Page1.asp do a loop and shows all products with some text fields to insert. When I press the insert button, all values are sent to page2.asp which does an split and insert all values using a for loop with arrays. The code in page2.asp is working Ok, but the problem is when I leave some records blank in page1.asp. I get the error: "Syntax error in INSERT INTO statement".
Here is the code I'm using in page2.asp:
I would like to know how to insert null values o better to know how not to insert when there are null values.
set Command1 = Server.CreateObject("ADODB.Connection")
Command1.ConnectionString = MM_mprince_STRING
for iLoop=0 to Ubound(strPRO)
strSQL = "insert into purchases (pro_id, mar_id, pur_size, pur_precio, pur_cantidad, pur_fecha) values ("&strPRO(iLoop)&","&strMAR(iLoop)&","&strSIZ(iLoop)&","&strPRE(iLoop)&","&strCANT(iLoop)&", #"&strFECH(iLoop)&"#)"
Set Command1 = Nothing
I will appreciate any help about this matter.