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!


    hi
    i wrote a component in vb.net(vb) 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.

    regards
    gowd

    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
    Try
    sqlconn = New SqlConnection("server=ruchisethi\NetSDK;database
    =HELLO;Trusted_Connection=yes")
    sqlconn.Open()
    sqlcmd = New SqlCommand("select * from CustomerMaster ",
    sqlconn)
    dread = sqlcmd.ExecuteReader()
    val = "false"
    while dread.Read()
    If trim(dread.Item("LoginName"))= trim(LoginName) Then
    val = "true"
    End If
    End While
    dread.Close()
    if val = "true" Then
    Register = "UserExist"
    Else
    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)
    sqlcmd.ExecuteNonQuery()
    Register = "success"
    End If
    sqlconn.Close()
    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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

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