J
Jerry
I have a connection to SQL Server and have setup a customer profile page
where the customer can change their information. All the fields when the SQL
update statement runs adds leading spaces to the database. I have used the
Trim() function and it works in the textboxes but stores the extra space.
Also, I have an Address2 line which in some cases are null and receive a
error message. Your help would be greatly appreciated.
Sample Code:
Function fixQuotes(theString)
fixQuotes = Replace(theString, "'","''")
End Function
strSql = "Update Tenant Set " &_
"Tenant = ' " & fixQuotes(Trim(Request.form("Tenantname"))) & "', " &_
"Address1 = ' " & fixQuotes(Trim(Request.form("Address1"))) & "', " &_
"Address2 = ' " & fixQuotes(Trim(Request.form("Address2"))) & "', " &_
"City = ' " & fixQuotes(Trim(Request.form("City"))) & "', " &_
"State = ' " & fixQuotes(Trim(Request.form("State"))) & "', " &_
"Zip = ' " & fixQuotes(Trim(Request.form("Zip"))) & "', " &_
"PhoneNumber = ' " & fixQuotes(Trim(Request.form("PhoneNumber"))) & "', " &_
"Email = ' " & fixQuotes(Trim(Request.form("email"))) & "', " &_
"Password = ' " & Trim(fixQuotes( Pass )) & "'" &_
"WHERE tenant.Customerid = '" & Cstr(Request.form("customer")) & "' "
set conn=Server.createObject("ADODB.connection")
conn.Open "DSN=Falco; uid=sa; pwd=6stang7"
conn.Execute strSql
conn.close
set conn = nothing
%>
where the customer can change their information. All the fields when the SQL
update statement runs adds leading spaces to the database. I have used the
Trim() function and it works in the textboxes but stores the extra space.
Also, I have an Address2 line which in some cases are null and receive a
error message. Your help would be greatly appreciated.
Sample Code:
Function fixQuotes(theString)
fixQuotes = Replace(theString, "'","''")
End Function
strSql = "Update Tenant Set " &_
"Tenant = ' " & fixQuotes(Trim(Request.form("Tenantname"))) & "', " &_
"Address1 = ' " & fixQuotes(Trim(Request.form("Address1"))) & "', " &_
"Address2 = ' " & fixQuotes(Trim(Request.form("Address2"))) & "', " &_
"City = ' " & fixQuotes(Trim(Request.form("City"))) & "', " &_
"State = ' " & fixQuotes(Trim(Request.form("State"))) & "', " &_
"Zip = ' " & fixQuotes(Trim(Request.form("Zip"))) & "', " &_
"PhoneNumber = ' " & fixQuotes(Trim(Request.form("PhoneNumber"))) & "', " &_
"Email = ' " & fixQuotes(Trim(Request.form("email"))) & "', " &_
"Password = ' " & Trim(fixQuotes( Pass )) & "'" &_
"WHERE tenant.Customerid = '" & Cstr(Request.form("customer")) & "' "
set conn=Server.createObject("ADODB.connection")
conn.Open "DSN=Falco; uid=sa; pwd=6stang7"
conn.Execute strSql
conn.close
set conn = nothing
%>