Torna al Thread

<System.Web.Script.Services.ScriptMethod(), System.Web.Services.WebMethod()> _ Public Shared Function SearchCustomers(ByVal prefixText As String, ByVal count As Integer) As List(Of String) Dim DBconn As New OleDb.OleDbConnection DBconn.ConnectionString = (ConfigurationManager.ConnectionStrings("connessione").ConnectionString) DBconn.Open() Dim DBComm As OleDbCommand DBComm = DBconn.CreateCommand() DBComm.CommandType = CommandType.Text DBComm.CommandText = "select nomi from Tabella1 where" & " nomi like @SearchText + '%'" DBComm.Parameters.AddWithValue("@SearchText", prefixText) Dim customers As List(Of String) = New List(Of String) Dim sdr As OleDbDataReader = DBComm.ExecuteReader() While sdr.Read customers.Add(sdr("nomi").ToString) End While DBconn.Close() Return customers End Function
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5