field values truncate at space?? Please help | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

field values truncate at space?? Please help

I have been working on an SQL Server, developing a backend db for an ASP website for a little while now. I am only learning, so quite new to it all. Would appreciate some help with the following; I currently have a form that updates a recordset in my SQL db. The field values that I am trying to write into text boxes are truncated if the field value has a space. e.g. Address: 20 Harbour Drive writes as 20 in the text box. When I view the detail page, no problems, recordset updated, but when I go back to the update page, the record values are truncated again. The size property of my textbox element is the same as the varchar datatype size in the SQL table. Can anyone help? Thanks in advance, this is driving me nuts.
Alex
Hi,
is your record is not updated in db ?! , would you copy that update string and run in Query Analyzer to see what happened ?! Regards Hemantgiri S. Goswami
[email protected]
"Humans don’t have Caliber to PASS TIME , Time it self Pass or Fail Humans" – by Hemantgiri Goswami

Bit stange. I think some porblem with your coding(ASP). I can’t see any reason from the DB side if you have given enough data lenght —————————————-
Cast your vote
http://www.geocities.com/dineshasanka/sqlserver05.html http://spaces.msn.com/members/dineshasanka

Thanks for your reply. Yes the update works fine upon submit.
When run from the update page, it updates into the SQL table perfectly. It’s actually when I request the values to be written to the update page, then it truncates them…. and if should hit the submit button again, it submits those new truncated values.
quote:Originally posted by ghemant Hi,
is your record is not updated in db ?! , would you copy that update string and run in Query Analyzer to see what happened ?! Regards Hemantgiri S. Goswami
[email protected]
"Humans don’t have Caliber to PASS TIME , Time it self Pass or Fail Humans" – by Hemantgiri Goswami

Yeah, I thought it may be too.
Have checked with ‘guru’ friend, who looked at it with me for a while, but we couldn’t work it out… Here’s a sample of my code (sorry for the length); A Sample of code from the form page: <TR>
<TD nowrap>surname:</TD>
<TD class="blackfields"><INPUT type="text" name="StuSurname" size="35" value= <% response.write rstonline("StuSurname") %>></TD>
<TD nowrap>suburb:</TD>
<TD class="blackfields"><INPUT type="text" name="StuSuburb" size="35" value= <% response.write rstonline("StuSuburb") %>></TD>
</TR> A Sample of code from the update page: <%
dim RecToUpdate
rstonline.Open "tblStudent", dbonline
‘RecToUpdate = rstonline("StudentID")
RecToUpdate = session("SelStudent") ‘StudentID = Request.Form("StudentID")
StuFirstName = Request.Form("StuFirstName")
StuSurname = Request.Form("StuSurname")
StuEmail = Request.Form("StuEmail")
StuStatus = Request.Form("StuStatus")
Etc strSQL = "UPDATE tblStudent SET StuFirstName = ‘" & StuFirstName & "’, StuSurname = ‘" & StuSurname & "’, StuEmail = ‘" & StuEmail & "’, StuStatus = ‘" & StuStatus & "’, StuBirthDate = ‘" & StuBirthDate & "’, StuAddress = ‘" & StuAddress & "’, StuSuburb = ‘" & StuSuburb & "’, StuPostcode = ‘" & StuPostcode & "’, StuHomePhone= ‘" & StuHomePhone & "’, StuMobile = ‘" & StuMobile & "’, StuFax = ‘" & StuFax & "’, StuInitialPassword = ‘" & StuInitialPassword & "’, StuWorkPhone = ‘" & StuWorkPhone & "’, IntroEmail = ‘" & IntroEmail & "’ WHERE StudentID = (‘" & RecToUpdate & "’)" set rstonline= dbonline.Execute(strSql) %>
quote:Originally posted by dineshasanka Bit stange. I think some porblem with your coding(ASP). I can’t see any reason from the DB side if you have given enough data lenght —————————————-
Cast your vote
http://www.geocities.com/dineshasanka/sqlserver05.html http://spaces.msn.com/members/dineshasanka

Table structure please! —————————————-
Cast your vote
http://www.geocities.com/dineshasanka/sqlserver05.html http://spaces.msn.com/members/dineshasanka

I said I was new at this! Is there something wrong with my table structure? Is that why it’s not working?
quote:Originally posted by dineshasanka Table structure please! —————————————-
Cast your vote
http://www.geocities.com/dineshasanka/sqlserver05.html http://spaces.msn.com/members/dineshasanka

Hi Alex,
Dinesh was asking if you could post the table structure so we can see if there is a problem with a datatype/field length… ‘I reject your reality and substitute my own’ – Adam Savage
]]>