|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Field blank when inserting record
Hi,
I'm having a problem with the INSERT statement below. Without sending back any errors, the record is inserted minus the clue field (txtClue on the form). Everything else inserts fine. Any ideas? Thanks Code:
insert.CommandText = "INSERT INTO tblUsers (password, email, active, access, firstName, lastName, company, customernumber, clue, answer) " &_
"VALUES ('" & Request.Form("txtPassword") & "', '" & Request.Form("txtEMail") & "', 'no', 'user', '" &_
Request.Form("txtFirstName") & "', '" & Request.Form("txtLastName") & "', '" & Request.Form("txtCompany") &_
"', " & Request.Form("txtCustomerNumber") & ", '" & Request.Form("txtClue") & "', '" & Request.Form("txtAnswer") & "')"
|
|
#2
|
||||
|
||||
|
well, if the row does get inserted, what gets put into the field? a null? a zero-length string? a blank?
are you sure the form actually has a field called txtClue? |
|
#3
|
|||
|
|||
|
Try debugging it first by outputting what "would" be executed. i.e. do something like this:
Code:
Response.Write "INSERT INTO tblUsers (password, email, active, access, firstName, lastName, company, customernumber, clue, answer) " &_
"VALUES ('" & Request.Form("txtPassword") & "', '" & Request.Form("txtEMail") & "', 'no', 'user', '" &_
Request.Form("txtFirstName") & "', '" & Request.Form("txtLastName") & "', '" & Request.Form("txtCompany") &_
"', " & Request.Form("txtCustomerNumber") & ", '" & Request.Form("txtClue") & "', '" & Request.Form("txtAnswer") & "')"
Response.End
Then if the "txtClue" field is blank, you have an ASP problem (i.e. the "txtClue" field is not submitted from the posting page). |
|
#4
|
|||
|
|||
|
I tried doing response.write for the insert statement, and everything displays as it should. the field 'txtClue' does get sent to the insert statement.
In response to the question of what gets put in the field, nothing. When I pull the db up in Access, it's just an empty field w/ no value. |
|
#5
|
||||
|
||||
|
can you show us the response-written string?
"nothing" could mean either null or a non-null zero-length string |
|
#6
|
|||
|
|||
|
The Response.Write output is:
Code:
INSERT INTO tblUsers (password, email, active, access, firstName, lastName, company, customernumber, clue, answer) VALUES ('1234', 'jdoe@abdcompany.com', 'no', 'user', 'John', 'Doe', 'ABC Company, Inc.', 1234, 'my question', 'my answer')
|
|
#7
|
||||
|
||||
|
well, that sure looks right, doesn't it
i have no idea |
|
#8
|
|||
|
|||
|
anyone.....please
|
|
#9
|
|||
|
|||
|
If the 'clue' is varchar, the insert should work. You should assign all parameters to the insert to variables before adding them to the INSERT statement. In this way you set a breakpoint and see the actual value of the variables. I suppose you are using VB or similar and you are able to set break points?
sPassword = Request.Form("txtPassword") sEMail = Request.Form("txtEMail") sClue = Request.Form("txtClue") insertStatement = "XXXX " & sClue & "XXX" db.execute(insertStatement) or something like this. The large statements you are using in the initial posting are ALWAYS difficult to debug. If this doesn't help, you might want to try to change the datatype of the clue column. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Field blank when inserting record |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|