Click to See Complete Forum and Search --> : insert form data into database


webdesign
08-10-2004, 02:48 PM
I'm trying to have form data be inserted into a database with asp, and I think I'm doing it right (but maybe I'm not)...I keep getting an error saying there is a syntax error in my INSERT INTO statement, but I can't seem to see it...can anyone help?

-------------------------------------------------------------------
<%

dim conn
set conn=Server.CreateObject("ADODB.connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=D:\InetPub\wwwroot\fpdb\disconnectDB.mdb"

input = "INSERT INTO dcData (month,day,year,phone,"
input = input & "cable,digital,cinemax,encore,hbo,starz,dialUp,jetNet,propel,speedGuard,localPhone,longDist,block900, restrict900,anonReject,callBack,recall,fwdBusy,"
input = input & "fwdNA,fwdRA,callWait,callNum,blockPerLine,blockPerCall,callNumName,collectBlock,trace,distinct,hotli ne,ldBulk,ldPerCall,selectAccept,selectFwd,selectReject,speedCall,superSpeed,"
input = input & "teen,telemarket,thirdBlock,voiceMail,warmline,changeProvider,moving,financial,other,reason) "
input = input & "VALUES ('" & dcMonth & "','" & dcDay & "','" & dcYear & "','" & phone & "',"
input = input & "'" & cable & "','" & digital & "','" & cinemax & "','" & encore & "','" & hbo & "','" & starz & "','" & dialUp & "','" & jetNet & "','" & propel & "','" & speedGuard & "','" & localPhone & "','" & longDist & "','" & block900 & "','" & restrict900 & "','" & anonReject & "','" & callBack & "','" & recall & "','" & fwdBusy & "',"
input = input & "'" & fwdNA & "','" & fwdRA & "','" & callWait & "','" & callNum & "','" & blockPerLine & "','" & blockPerCall & "','" & callNumName & "','" & collectBlock & "','" & trace & "','" & distinct & "','" & hotline & "','" & ldBulk & "','" & ldPerCall & "','" & selectAccept & "','" & selectFwd & "','" & selectReject & "','" & speedCall & "','" & superSpeed & "',"
input = input & "'" & teen & "','" & telemarket & "','" & thirdBlock & "','" & voiceMail & "','" & warmline & "','" & changeProvider & "','" & moving & "','" & financial & "','" & other & "','" & reason & "')"


conn.execute(input)

%>

webdesign
08-10-2004, 02:53 PM
sorry that looks so crappy..I didn't think it would be that bad...here's a bit cleaner one

------------------------------------------------------

input = "INSERT INTO dcData (month,day,year,phone,cable,digital,cinemax,encore,hbo,starz,"
input = input & "dialUp,jetNet,propel,speedGuard,localPhone,longDist,block900,restrict900,"
input = input & "anonReject,callback,recall,fwdBusy,fwdNA,fwdRA,callWait,callNum,blockPerLine,"
input = input & "blockPerCall,callNumName,collectBlock,trace,distinct,hotline,ldBulk,ldPerCall,"
input = input & "selectAccept,selectFwd,selectReject,speedCall,superSpeed,teen,telemarket,"
input = input & "thirdBlock,voiceMail,warmline,changeProvider,moving,financial,other,reason) "
input=input & "VALUES ('" & dcMonth & "','" & dcDay & "','" & dcYear & "','" & phone & "',"
input=input & "'" & cable & "','" & digital & "','" & cinemax & "','" & encore & "',"
input=input & "'" & hbo & "','" & starz & "','" & dialUp & "','" & jetNet & "','" & propel & "',"
input=input & "'" & speedGuard & "','" & localPhone & "','" & longDist & "','" & block900 & "',"
input=input & "'" & restrict900 & "','" & anonReject & "','" & callBack & "','" & recall & "',"
input=input & "'" & fwdBusy & "','" & fwdNA & "','" & fwdRA & "','" & callWait & "','" & callNum & "',"
input=input & "'" & blockPerLine & "','" & blockPerCall & "','" & collectBlock & "','" & trace & "',"
input=input & "'" & distinct & "','" & hotline & "','" & ldBulk & "','" & ldPerCall & "','" & selectAccept & "',"
input=input & "'" & selectFwd & "','" & selectReject & "','" & speedCall & "','" & superSpeed & "',"
input=input & "'" & teen & "','" & telemarket & "','" & thirdBlock & "','" & voiceMail & "','" & warmline & "',"
input=input & "'" & changeProvider & "','" & moving & "','" & financial & "','" & other & "','" & reason & "')"

CardboardHammer
08-10-2004, 03:16 PM
How about you do a response.write of input (after it's built), and show us that?