You need to Register for free and Login to post a message in the forum.

Forum

Subject: autocomplete extender
Prev Next
You are not authorized to post a reply.

Author Messages
HSS
Nuke Newbie
Nuke Newbie
Posts:1

29 May 2008 11:58 AM  

 I am a beginner in ASP.Net AJAX  , I am using Visual Studio2005 and I am trying to implement AutoComplete with an Access database connection I search for the code which I should put inside the web service and I hardly found this code which is written in VB and deal with access.. but still I don’t know wither this code is correct or not and where I should make changes to appropriate with mine..

 

  • The web service I call it AutoComplete.
  • The search text box I call it myTextBox.
  • The access database is in C:\Documents and Settings\user\My Documents\Visual Studio 2005\WebSites\AutoComplete\db1.mdb
  • The table which I choose from is recipes.
  • The column I should choose the word from is Name.

 

The code is:

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System
Imports System.IO
Imports System.Collections
Imports System.Collections.Generic
Imports System.Threading
Imports System.Xml.Serialization
Imports System.Data
Imports System.Data.SqlClient

Public Class WebService
     Inherits System.Web.Services.WebService
     _
     Public Function GetWordList(ByVal prefixText As String, _
          ByVal count As Integer) As String()
        If autoCompleteWordList Is Nothing Then
            Dim MyArrayList As ArrayList = New ArrayList
            Dim connectionString As String = System.Configuration.ConfigurationManager.ConnectionStrings("medsidConnectionString").ConnectionString.ToString
            Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)
            Dim queryString As String = "SELECT Distinct([Pacientes].Nombre) FROM [Pacientes] WHERE '" & prefixText & "%' ORDER BY Nombre"
            Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
            dbCommand.CommandText = queryString
            dbCommand.Connection = dbConnection
            dbConnection.Open()
            Dim dataReader As System.Data.IDataReader = dbCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
            While dataReader.Read()
                MyArrayList.Add(dataReader("Nombre"))
            End While
Dim temp As IDataReader() = CType(MyArrayList.ToArray(GetType(IDataReader)), IDataReader())

                temp = MyArrayList.ToArray()

            Array.Sort(temp, New CaseInsensitiveComparer())
            autoCompleteWordList = temp
        End If
        Dim index As Integer = Array.BinarySearch(autoCompleteWordList, _
          prefixText, New CaseInsensitiveComparer())
        If index < 0 Then
            index = Not index
        End If
        Dim matchingCount As Integer
        For matchingCount = 0 To count - 1
            If Not (matchingCount + index) < autoCompleteWordList.Length Then
                Exit For
            End If
            If Not autoCompleteWordList((index _
              + matchingCount)).StartsWith(prefixText, _
              StringComparison.CurrentCultureIgnoreCase) Then
                Exit For
            End If
        Next matchingCount
        Dim returnValue(matchingCount - 1) As String
        If matchingCount > 0 Then
            Array.Copy(autoCompleteWordList, index, returnValue, 0, _
              matchingCount)
        End If
        Return returnValue
    End Function
End Class

 

Any advise would be helpful, thanks

You are not authorized to post a reply.
Forums > DotNetNuke® > DotNetNuke® Questions > autocomplete extender



ActiveForums 3.7

Latest Forum Posts

RE: Keep Testing Skins by ollep
Some details re Logo possition: HTML:div class="header">p>[LOGO]p>div>Found possitioning in "index_...
Pathing issues after setting up a domain name by harlowj
I had a site configured here: http://www.autorotate.com/portal/chl (all works good)I then decided to...
RE: Keep Testing Skins by ollep
Hi Lee – and Joe   I’m Using DNN 4.5.5   I just installed Summer Breeze Skin and Template, and a...
RE: DNN - web services not working by jncraig
Do your web services have their own config files? Are they located in actual directories below the ...
RE: Installation on Vista by jncraig
You install Visual Studio according to the installation instructions. Once installed, you can "open...
Installation on Vista by jesp17
I followed the how to install DNN to Vista, but what I miss is the intallation of visual studio. Can...
RE: Building a website with DNN by freedom22
Hi Lee, Thanks for getting back to me. I understand now what you are saying, but I am still confuse...
RE: How to limit access to the admin menu.... by tallorder
Hi Lee Unfortunately I can't see how it works in reverse because the original process involved movi...
RE: Building a website with DNN by leesykes
Hello,Those classes refer to the menu, and therefore will not be specified in your skin.htm file as ...
RE: [HOUSEMENU] token not working by leesykes
Glad you sorted it, thanks,
RE: [HOUSEMENU] token not working by whred5
OK I fixed myself after googling the problem. If anyone else comes across this situation you need t...
DNN - web services not working by paulrobinson
Good Afternoon,Please help.  I have just installed my DNN web site to my dedicated live host machine...
[HOUSEMENU] token not working by whred5
HiI have been playing around with the Lazy_Days skin in an effort to learn css based skinning, I hav...
RE: Building a website with DNN by freedom22
Lee or Joe, I meant that the skin.css file I downloaded has classes like .main_dnnmenu_item td w...
RE: Building a website with DNN by freedom22
Lee, thanks for your reply. I did find the files. I am going through your tutorail, and in video7...
RE: page publish date by leesykes
I would suggest you view these tutorials:User Accounts new features User Accounts and User Settings ...
RE: page publish date by jncraig
I'm not quite sure that I understand you, but ... on the user accounts page there are these options:...
RE: Best so far for me by jncraig
I like the Snapsis CSS Nav Menu. You'll find it at Snapsis.com.
RE: How to limit access to the admin menu.... by leesykes
Hello,Simply reverse the process, you can copy the settings from one of the other admin menu items t...
RE: How to limit access to the admin menu.... by tallorder
Shame about the parent page drop down being grey out since any Site Administrator is going to want t...
AppTheory
RSS Feeds