M
Mark A. Sam
The following ASP code snippet works when posting to an Access DB, but the
page hangs when I apply this to an SQL Database. I believe this code is the
issue. Is there some special property I am missing or different syntax that
needs to be applied here?
Thanks for any help and God Bless,
Mark A. Sam
if Request("mode") = "NEW" then
getfields()
Set rs = Server.CreateObject("ADODB.RecordSet")
q = "INSERT INTO CompanyInfo (Company,Contact,Address1,Address2," &_
"City,State,Zip,Country,Phone,Email,Key,DisplayEmail,DisplayPhone," &_
"Trucker,Shipper,TruckBroker,FoodBroker,Manufacturer,Merchandiser," &_
"Distributor,LTLCarrier,OtherType,trkNoUnits,trkStates,trkReefer,trkVan,"
&_
"trkFlatBed,trkDumpTruck,trkOther,shpLoads," &_
"shpStates,shpReefer,shpVan,shpFlatbed,shpDumpTruck,shpOther,Comments,Active
,howsitefound)" &_
" VALUES ('" & company & "','" & contact & "','" & address1 & "','" &
address2 &_
"','" & city & "','" & state & "','" & zip & "','" & country & "','" &
phone &_
"','" & email & "','" & key & "','" & displayemail & "','" & displayphone
&_
"'," & trucker & "," & shipper & "," & truckbroker & "," & foodbroker &
"," &_
manufacturer & "," & merchandiser & "," & distributor & "," & ltlcarrier
&_
",'" & othertype & "'," & trknounits & "," & trkstates & "," & trkreefer
&_
"," & trkvan & "," & trkflatbed & "," & trkdumptruck & ",'" & trkother &
"'," &_
shploads & "," & shpstates & "," & shpreefer & "," & shpvan & "," &
shpflatbed &_
"," & shpdumptruck & ",'" & shpother & "','" & comments & "',1,'" &
howsitefound & "')"
rs.Open q, "DSN=TruckloadsSQL;"
q = "SELECT Max(CompanyID) AS coid FROM CompanyInfo"
rs.Open q, "DSN=TruckloadsSQL;"
coid = rs("coid").value
Response.Cookies("coid") = coid
Response.Cookies("key") = key
d = Date
Response.Cookies("coid").expires = DateAdd("yyyy", 2, d)
Response.Cookies("key").expires = DateAdd("yyyy", 2, d)
mess = "Your Record has been added to the database. Your Company ID number
is " &_
coid & ". Your password is " & key & ". Please write them down. " &_
"You may edit your record now, if you wish"
rs.Close
Set rs = Nothing
page hangs when I apply this to an SQL Database. I believe this code is the
issue. Is there some special property I am missing or different syntax that
needs to be applied here?
Thanks for any help and God Bless,
Mark A. Sam
if Request("mode") = "NEW" then
getfields()
Set rs = Server.CreateObject("ADODB.RecordSet")
q = "INSERT INTO CompanyInfo (Company,Contact,Address1,Address2," &_
"City,State,Zip,Country,Phone,Email,Key,DisplayEmail,DisplayPhone," &_
"Trucker,Shipper,TruckBroker,FoodBroker,Manufacturer,Merchandiser," &_
"Distributor,LTLCarrier,OtherType,trkNoUnits,trkStates,trkReefer,trkVan,"
&_
"trkFlatBed,trkDumpTruck,trkOther,shpLoads," &_
"shpStates,shpReefer,shpVan,shpFlatbed,shpDumpTruck,shpOther,Comments,Active
,howsitefound)" &_
" VALUES ('" & company & "','" & contact & "','" & address1 & "','" &
address2 &_
"','" & city & "','" & state & "','" & zip & "','" & country & "','" &
phone &_
"','" & email & "','" & key & "','" & displayemail & "','" & displayphone
&_
"'," & trucker & "," & shipper & "," & truckbroker & "," & foodbroker &
"," &_
manufacturer & "," & merchandiser & "," & distributor & "," & ltlcarrier
&_
",'" & othertype & "'," & trknounits & "," & trkstates & "," & trkreefer
&_
"," & trkvan & "," & trkflatbed & "," & trkdumptruck & ",'" & trkother &
"'," &_
shploads & "," & shpstates & "," & shpreefer & "," & shpvan & "," &
shpflatbed &_
"," & shpdumptruck & ",'" & shpother & "','" & comments & "',1,'" &
howsitefound & "')"
rs.Open q, "DSN=TruckloadsSQL;"
q = "SELECT Max(CompanyID) AS coid FROM CompanyInfo"
rs.Open q, "DSN=TruckloadsSQL;"
coid = rs("coid").value
Response.Cookies("coid") = coid
Response.Cookies("key") = key
d = Date
Response.Cookies("coid").expires = DateAdd("yyyy", 2, d)
Response.Cookies("key").expires = DateAdd("yyyy", 2, d)
mess = "Your Record has been added to the database. Your Company ID number
is " &_
coid & ". Your password is " & key & ". Please write them down. " &_
"You may edit your record now, if you wish"
rs.Close
Set rs = Nothing