Converting varchar to Integer

Results 1 to 5 of 5

Thread: Converting varchar to Integer

  1. #1
    Ty Robbins Guest

    Default Converting varchar to Integer

    I am trying to query a table on it&#039;s identity field. The data type is a integer. The submit form for the query is a text box. I get the standard type mismatch error on the page when I try to run the search. I tried the CInt(varibale) but it didn&#039;t work either.<BR><BR>How do I get this conversion to work?<BR><BR>Thanks. -Ty

  2. #2
    Jiminez Guest

    Default RE: Converting varchar to Integer

    You are trying to query an Identity using text from a textbox? You mean, like typing in 36 to match identity 36? Why ever would you do this?<BR>The identity should be used behind the scenes - why would your users want to know an internal tracking number?

  3. #3
    Join Date
    Dec 1969

    Default RE: Converting varchar to Integer

    the integer in SQL server is a Long in vb/vbscript so try using cLng()

  4. #4
    Ty Robbins Guest

    Default RE: Converting varchar to Integer

    This is an internal application that tracks bug in our software. The TicketID is an auto generated Identity with a seed of 1000. This field is not the primary key.<BR><BR>I didn&#039;t realize that asking for help here would start a philosophical debate. Thank you for being critical without offering any help. Why ever would you do this?

  5. #5
    Ty Robbins Guest

    Default RE: Converting varchar to Integer

    Bill,<BR><BR>Thanks for offering your advice. I did try this and the result was the same. The error message was:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)<BR>[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value &#039;TicketNO&#039; to a column of data type int.<BR><BR>Are there any other suggestions you could offer? Thanks again.<BR><BR>Ty

Posting Permissions

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