Torna al Thread

Public Shared Function SearchCustomers(ByVal prefixText As String, ByVal count As Integer) As List(Of String) Dim DBconn As New OleDbConnection DBconn.ConnectionString = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}mdb-database\prova\auto.mdb;") 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) DBComm.ExecuteReader() 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