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.
Locked
User avatar
rcandela
Posts: 6
Joined: Mon Aug 27, 2012 3:42 am

Trailing Spaces After Data?

Post by rcandela » Fri Aug 31, 2012 4:40 am

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)

Locked