Convert Data Type of Data Column

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • neeraj

    #1

    Convert Data Type of Data Column

    Hi All
    Can any give me the code for convert "DataColumn " data type of
    "DataTable" . Even if data table already populated (have data)

    Actually I am creating one search module which searches the data from
    "DataView" using "RowFilter" method. Here I m using like
    operator for searching, its work fine for string but if data type of
    "Data Column" is Date or Integer then its not working.

    Now I m decide I will convert data types of all column as string but
    here one another problem occurring,
    We can not convert data type of column if "DataTable" has data.

    I don't want to do it though looping like create one another table
    with all string data type columns and place all records to this new
    data table one by one.

    This is the code for searching.

    Working fine
    dv.RowFilter = "Employee_N ame like '" & txtSearchValue & "%'"

    Not Working fine
    dv.RowFilter = "Employee_i d like '" & txtSearchValue & "%'"


    please conceder it, for interger serching I also don't want to search
    like this.

    dv.RowFilter = "Employee_i d >=" & txtSearchValue

  • Cor Ligthert [MVP]

    #2
    Re: Convert Data Type of Data Column

    Neeraj,

    You cannot do a convert in an existing table, however more important, what
    datatype is the sender and what is the result. I think you want strings, but
    before we take senseless time.

    Cor

    "neeraj" <neeraj.nav@gma il.comschreef in bericht
    news:1169889183 .463811.180550@ l53g2000cwa.goo glegroups.com.. .
    Hi All
    Can any give me the code for convert "DataColumn " data type of
    "DataTable" . Even if data table already populated (have data)
    >
    Actually I am creating one search module which searches the data from
    "DataView" using "RowFilter" method. Here I m using like
    operator for searching, its work fine for string but if data type of
    "Data Column" is Date or Integer then its not working.
    >
    Now I m decide I will convert data types of all column as string but
    here one another problem occurring,
    We can not convert data type of column if "DataTable" has data.
    >
    I don't want to do it though looping like create one another table
    with all string data type columns and place all records to this new
    data table one by one.
    >
    This is the code for searching.
    >
    Working fine
    dv.RowFilter = "Employee_N ame like '" & txtSearchValue & "%'"
    >
    Not Working fine
    dv.RowFilter = "Employee_i d like '" & txtSearchValue & "%'"
    >
    >
    please conceder it, for interger serching I also don't want to search
    like this.
    >
    dv.RowFilter = "Employee_i d >=" & txtSearchValue
    >

    Comment

    Working...