DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: trim Function!

  1. #1
    Veerendra Gowd Guest

    trim Function!

    i wrote a component in whihc contains a mothod named "Register".
    it takes the persons info(parameters) and insert in to database .
    its also checking the login id given by the customer and exisitng in th databse.if
    it exists and returns message "user exist" else the info is inserted and
    returns "success".
    while comparing the login id from databse and the parameter, i used the trim
    funaction for bothe(code is given below).
    but its not able to compile, i m getting error "Trim" is not defined or declared.
    so please help in this regard.
    in which dll file i ahve to import for that.


    Imports System
    Imports System.Data
    Imports System.Data.SqlClient
    Namespace Customer

    Public Class CustomerAC
    Dim sqlconn As SqlConnection
    Dim sqlcmd As SqlCommand
    Dim val As String
    Dim dread As SqlDataReader

    Public Function Register(ByVal FName As String, ByVal MName As String,
    ByVal Lname As String, ByVal DOB As Date, ByVal Gender As String, ByVal Address
    As String, ByVal City As String, ByVal State As String, ByVal Country As
    String, ByVal ZIP As Integer, ByVal MailAddress As String, ByVal PhoneNumber
    As String, ByVal HintQuestion As String, ByVal HintAnswer As String, ByVal
    LoginName As String, ByVal LoginPswd As String) As String
    sqlconn = New SqlConnection("server=ruchisethi\NetSDK;database
    sqlcmd = New SqlCommand("select * from CustomerMaster ",
    dread = sqlcmd.ExecuteReader()
    val = "false"
    while dread.Read()
    If trim(dread.Item("LoginName"))= trim(LoginName) Then
    val = "true"
    End If
    End While
    if val = "true" Then
    Register = "UserExist"
    sqlcmd = New SqlCommand("insert CustomerMaster (FirstName,MiddleIntials,LastName,DOB,Gender,Address,City,State,Country,ZIP,Email,PhoneNum ber,RegQuestion,RegAnswer,LoginName,LoginPswd)
    values ( '" & FName & "','" & MName & "','" & Lname & "','" & DOB & "','"
    & Gender & "','" & Address & "' ,'" & City & "','" & State & "','" & Country
    & "','" & ZIP & "','" & MailAddress & "','" & PhoneNumber & "','" & HintQuestion
    & "','" & HintAnswer & "','" & LoginName & "','" & LoginPswd & "')", sqlconn)
    Register = "success"
    End If
    Catch exc As Exception
    Register = exc.ToString()
    End Try
    End Function

    End Class

    End Namespace

  2. #2
    Phil Weber Guest

    Re: trim Function!

    > while comparing the login id from database and the parameter,
    > I used the Trim function for both..., but its not able to compile,
    > i'm getting error "Trim" is not defined or declared.

    Gowd: Trim works fine on my system. It's defined in the System.String and
    Microsoft.VisualBasic.Strings namespaces.
    Phil Weber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center