Autocomplete dropping leading zeros and trailing zeros after a hyphen

Last post 05-02-2008 2:55 AM by tdecker81. 1 replies.

Sort Posts:

  • Autocomplete dropping leading zeros and trailing zeros after a hyphen

    04-30-2008, 2:54 PM
    • Member
      5 point Member
    • tdecker81
    • Member since 06-24-2006, 7:54 PM
    • Posts 10

    Autocomplete Web Service Code

    1    Imports System.Web
    2    Imports System.Web.Services
    3    Imports System.Web.Services.Protocols
    4    Imports System.Data.SqlClient
    5    Imports System.Data
    6   
    7    ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    8    <System.Web.Script.Services.ScriptService()> _
    9    <WebService(Namespace:="http://tempuri.org/")> _
    10   <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
    11   <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    12   Public Class AutoComplete
    13       Inherits System.Web.Services.WebService
    14  
    15       <WebMethod()> _
    16       Public Function GetOrderNumber(ByVal prefixText As String, ByVal count As Integer) As String()
    17        
    18           Dim emp As New List(Of String)
    19  
    20           Dim conn As String = "Data Source=GLPT-SQL\CSI_SQL;Initial Catalog=CSITSS;Persist Security Info=True;User ID=*******;Password=*********"
    21  
    22           Dim query As String = "SELECT O.[OrderNumber] FROM [CSITSS].[dbo].[Orders] as O WHERE O.CompanyDiv = 'GLPC-TRANS' and O.Deleted = 0 and O.Terminal = 'COD' and (OrderNumber LIKE '%" & prefixText & "%')"
    23  
    24           Dim da As New SqlDataAdapter(query, conn)
    25  
    26           Dim ds As New DataSet
    27           da.Fill(ds)
    28  
    29           If ds.Tables(0).Rows.Count < count Then
    30               count = ds.Tables(0).Rows.Count
    31           End If
    32           Dim items As New List(Of String)
    33           For i As Integer = 1 To count
    34  
    35               items.Add(ds.Tables(0).Rows(i - 1).Item(0).ToString)
    36  
    37           Next i
    38  
    39           Return items.ToArray()
    40  
    41       End Function
    42       <WebMethod()> _
    43       Public Function GetPropertyID(ByVal prefixText As String, ByVal count As Integer) As String()
    44  
    45           Dim emp As New List(Of String)
    46  
    47           Dim conn As String = "
    Data Source=GLPT-SQL\CSI_SQL;Initial Catalog=CSITSS;Persist Security Info=True;User ID=*******;Password=*********"
    48  
    49           Dim query As String = "
    SELECT [CustomerID] FROM [CSITSS].[dbo].[Customer] WHERE CustomerID < '9999999999' and CompanyDiv = 'GLPC-TRANS' and (CustomerID LIKE '%" & prefixText & "%')"
    50  
    51           Dim da As New SqlDataAdapter(query, conn)
    52  
    53           Dim ds As New DataSet
    54           da.Fill(ds)
    55  
    56           If ds.Tables(0).Rows.Count < count Then
    57               count = ds.Tables(0).Rows.Count
    58           End If
    59           Dim
    items As New List(Of String)
    60           For i As Integer = 1 To count
    61  
    62               items.Add(ds.Tables(0).Rows(i - 1).Item(0).ToString)
    63  
    64           Next i
    65  
    66           Return items.ToArray()
    67  
    68       End Function
    69  
    70   End Class

     This web service works but the output below isn't what shows up on the autocomplete menu. 

    GetOrderNumber Results

    1       
    2    - <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
    3      <string>00064979-0</string> 
    4      </ArrayOfString>
    
     
    GetPropertyID Results
    1     
    2    - <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
    3      <string>0009620000</string>
    4      <string>0459620000</string>
    5      </ArrayOfString>
     
    GetOrderNumber Results on Textbox
     
    64979
     
    GetPropertyId Results on Textbox
    9620000
    459620000
     
    How do I make it display the entire string result???
  • Re: Autocomplete dropping leading zeros and trailing zeros after a hyphen

    05-02-2008, 2:55 AM
Page 1 of 1 (2 items)