|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
i'm having trouble with a query i'm trying to run in an asp page of mine. i'm trying to insert data into an ms sql db. my code is:
strSQL = "INSERT INTO ServiceRequest(FirstName, Initial, LastName, LanID, Phone, OperatingUnit,"_ & " Email, Location, ApexUpgrade, ApexInstall, RequestDate, ComputerID, ManagerName, ManagerEmail)"_ & " VALUES('" & request("FirstName") & "','" & request("Initial") & "','" & "',"_ & "'" & request("LastName") & "','" & request("LanID") & "','" & request("Phone") & "',"_ & "'" & request("OperatingUnit") & "','" & FullEmail & "','" & request("Location") & "',"_ & "'" & request("ApexUpgrade") & "','" & request("ApexInstall") & "','" & DateTime & "',"_ & "'" & request("ComputerID") & "','" & request("ManagerName") & "','" & request("ManagerEmail") & "')" This gives me an error saying that "There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement." When I look, it seems like there are the same number of values in each the INSERT and VALUES parts. what am i counting wrong? ![]() |
|
#2
|
||||
|
||||
|
Have you tried printing out your SQL statement? I've never done any ASP programming before, but I'm assuming & is string contatenation. Looks like you're entering an extra blank value '' here:
& request("Initial") & "','" & "',"_ & "'" & request("LastName") & Looks like there's an extra entry between Initial and LastName. HTH -b
__________________
PostgreSQL, it's what's for dinner... |
|
#3
|
||||
|
||||
|
that was it, thanks bcyde. guess this was one of those times i've looked at the code so much i didn't really pay attention anymore. It works perfectly now
|
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > query error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|