Trailing Spaces After Data?

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 11 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
rcandela
Posts: 6
Last visit: Thu Sep 13, 2012 4:10 am

Trailing Spaces After Data?

Post by rcandela »

I have an <input> field that automatically gets set with a value based on data from a SQL table:

Code: Select all

<input name="FirstName" type="text" id="FirstName" value="<%=(rsUsersMod.Fields.Item("FIRST_NAME").Value)%>" size="20" readonly>
This form on the site is posting the value of the above input table to a New table. So when I insert in to the separate table, the value from that table, it adds a bunch of trailing spaces after the value. Anyone know how to stop the trailing spaces?

Code: Select all

If Request.Form("send") = "requestOff" Then
     strSQL ="SET NOCOUNT ON; " &_
               "INSERT INTO RequestOff (" &_
               "FirstName," &_
               "LastName," &_
               "RequestTypeID," &_
               "StartDate," &_ 
               "EndDate," &_
               "ReasonAbsence," &_
               "Manager," &_
               "Signature," &_
               "DateSubmitted" &_
               ") VALUES (" &_
               "'" & Request.Form("FirstName") & "'," &_
               "'" & Request.Form("LastName") & "'," &_
               "'" & Request.Form("RequestTypeID") & "'," &_
               "'" & Request.Form("StartDate") & "'," &_
               "'" & Request.Form("EndDate") & "'," &_
               "'" & Request.Form("ReasonAbsence") & "'," &_
               "'" & Request.Form("Manager") & "'," &_
               "'" & Request.Form("Signature") & "'," &_
               "'" & Date() & "');" &_
               "SELECT @@Identity AS Ident; "
               'Response.Write(strSQL)
               dbConn.Execute(strSQL)
               IF ((Session("Level") = "Admin")) Then
               ErrorMess = "<font color=#77ae99>Request Has Been Received!</font>"
               Else
               Response.Redirect("log-time.asp?id=" & Request.Form("recordId") & "")
               End If
End If
The SQL column is NCHAR(50)
This topic is 11 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked