Re: leading spaces



Hi Jerry,

You're trimming alright, but adding a space back in. Example:

"Tenant = ' " & fixQuotes(Trim(Request.form("Tenantname"))) & "', "

Note the space after the single quote, right after "Tenant ="

As for nulls, you shouldn't be having any problems with that. An empty text
box has a value of "", which is an empty string, not null. If you're having
a problem there, it lies in something I don't see. You might want to check
your rules in the database.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
I'd rather be a hammer than a nail.

"Jerry" <Jerry@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C66053C4-20F7-4EDA-A94A-CCB14B77EAC9@xxxxxxxxxxxxxxxx
>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
>
> %>
>


.



Relevant Pages

  • Re: leading spaces
    ... "Kevin Spencer" wrote: ... >>I have a connection to SQL Server and have setup a customer profile page ... >> update statement runs adds leading spaces to the database. ...
    (microsoft.public.frontpage.programming)
  • Re: MS Access DAO -> ADO.NET Migration
    ... William Vaughn ... Microsoft MVP ... Hitchhiker's Guide to Visual Studio and SQL Server ... My migration app works building a SSCE database file with imported data ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Cluster will not fail over.
    ... > As far as the TCP/IP issue goes, you had to rebuild the cluster and were ... > able to restore the master database. ... > a cluster installation you'll have to revisit. ... >> This worked bringing up the sql server in minimal mode. ...
    (microsoft.public.sqlserver.clustering)
  • Re: MS Access DAO -> ADO.NET Migration
    ... For that it is much harder to handle the incremental identifier, ... database but although they have the data, they are not connected at the same ... The book was a pleasure to read after the gibberish that Microsoft 'puts ... SQL Server Management Studio is nowhere to be found on my ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Word 2003/Access2000/SQLSVR
    ... SQL server being where the data is held and this is accessed through a MS ... entire database and that may be say a record for Berkshire. ... "Peter Jamieson" wrote: ... replaced with the first record on the table in use. ...
    (microsoft.public.word.mailmerge.fields)