Problem with empty character

Results 1 to 2 of 2

Thread: Problem with empty character

  1. #1
    Aria Shimen Guest

    Default Problem with empty character

    I am working on asp script that gets data from database(MS-SQL server 7.0). The script seems works fine, but in a closer look it puts empty character behind the data.<BR>Example if I want to print the Name field, the result is then "MyName ".<BR><BR>Please, please help me now!<BR><BR>Here is part of my login.asp:<BR>----------------------------------<BR>SQL="SELECT * FROM Users"<BR> set cn = Server.CreateObject("ADODB.Connection")<BR> cn.Open Session("ODBC")<BR> set rs = Server.CreateObject("ADODB.Recordset")<BR> rs.open SQL, cn, 1, 1<BR><BR>if rs("login")=request.form("login") then<BR> response.write "Login OK!"<BR>else<BR> response.write "Login Failed!"<BR>end if<BR>---------------------------------<BR><BR>&#060;aria>

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: Problem with empty character

    You can use the trim function to get rid of unwanted spaces! (See http://help.activeserverpages.com/iishelp/VBScript/htm/vbs154.htm for technical details!)<BR><BR>Anyway, what you&#039ll want to do is:<BR><BR>if trim(rs("login")) = request.form("login") then<BR>...<BR><BR>Trim just removes any leading and trailing blank characters. Good luck and happy programming!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •