Autocomplete dropping leading zeros and trailing zeros after a hyphen

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    _
9    Namespace:="http://tempuri.org/")> _
10   _
11   _
12   Public Class AutoComplete
13       Inherits System.Web.Services.WebService
14  
15       _
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       _
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

                
0 tdecker81 4/30/2008 6:54:40 PM

I found the answer on another forum. http://forums.asp.net/t/1192542.aspx 

 


Need a new credit Card?
Get a free system for generating up to 12 new streams of income and 22 videos on web promotion.
0 tdecker81 5/2/2008 6:55:31 AM
Reply:

(Thread closed)