473,507 Members | 13,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AJAX-AutoComplete Oracle VB.NET

7 New Member
I am having problems using the ajax autocomplete. I actually think it may be an Oracle problem not autocomplete problem because I can get the autocomplete working without searching the database for like values. Here is my code:
Expand|Select|Wrap|Line Numbers
  1. Imports System
  2. Imports System.IO
  3. Imports System.Web
  4. Imports System.Web.Services
  5. Imports System.Web.Services.Protocols
  6. Imports System.Collections
  7. Imports System.Collections.Generic
  8. Imports System.Threading
  9. Imports System.Xml.Serialization
  10. Imports System.Data.Common
  11. Imports System.Data              ' VB.NET
  12. Imports Oracle.DataAccess.Client
  13.  
  14. <WebService(Namespace:="http://tempuri.org/")> _
  15. <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
  16. <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
  17. <System.Web.Script.Services.ScriptService()> _
  18. Public Class AutoCompleteDAL
  19.     Inherits System.Web.Services.WebService
  20.     Public Shared autoCompleteWordList As String()
  21.  
  22.  
  23.     <WebMethod()> _
  24.     Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As String()
  25.  
  26.         Dim Sql As String = "SELECT NAME from NAMELIST WHERE NAME  LIKE '" & prefixText & "' || '%' ORDER BY NAME ;"
  27.         Dim Conn As New _
  28.                OracleClient.OracleConnection(ConfigurationManager.ConnectionStrings( _
  29.               "OrdConnectionString").ConnectionString)
  30.         ' Dim Conn As OracleConnection = New OracleConnection("Data Source=dbHazard;User ID=HazUser;Password=password")
  31.         '  Dim cmd As New OracleCommand(Sql, Conn)
  32.         Dim cmd As New OracleClient.OracleCommand(Sql, Conn)
  33.         Dim items As New List(Of String)
  34.         Dim dr As OracleClient.OracleDataReader = cmd.ExecuteReader() ' VB.NET
  35.         While dr.Read() ' VB.NET
  36.             items.Add(dr.Item("NAME"))
  37.         End While
  38.  
  39.         'items.Add(dr.Item("NAME"))
  40.         Return items.ToArray
  41.  
  42.  
  43.  
  44.     End Function
  45.  
  46.  
  47. End Class
  48.  
Any assistance would be greatly appreciated. Thanks.
Jul 9 '07 #1
10 4018
Frinavale
9,735 Recognized Expert Moderator Expert
Welcome to TSDN :) I hope you like it here!

What is the error message you're getting?
If there's no error message, could you better explain what is happening?
Have you tried returning a clone of your items array?

Thanks,
-Frinny
Jul 9 '07 #2
kym
7 New Member
I do like it here! I have been searching the site for awhile but this is the first time I posted anything. I am not getting an error. I am not getting anything at all. Thanks. The autocomplete works when I am not using the Oracle datareader. It does nothing when insert in the oracle stuff. Thanks.



<asp:TextBox ID="txtNAME" runat="server" MaxLength="5"></asp:TextBox>
<ajaxtoolkit:AutoCompleteExtender ID="AutoCompleteExtender1"
TargetControlID="txtNAME" Enabled="True" ServicePath="AutoComplete.asmx"
ServiceMethod="GetCompletionList" MinimumPrefixLength="0" runat="server" FirstRowSelected="true" >

</ajaxtoolkit:AutoCompleteExtender>
Jul 10 '07 #3
kym
7 New Member
Have you tried returning a clone of your items array? No, not sure what this is. I am new to both vb.net and oracle.
Jul 10 '07 #4
Frinavale
9,735 Recognized Expert Moderator Expert
You should close your data reader when you are done with it to clean things up.
Could you possibly post the code for where you are assigning your "items" array to the control using the auto complete?

Have you tried declaring your items array like this:
Expand|Select|Wrap|Line Numbers
  1. Dim items() As New String
  2.  
Instead of like this:
Expand|Select|Wrap|Line Numbers
  1. Dim items As New List(Of String)
  2.  
I don't think you'll need to use items.ToArray in your return statement if you change your declaration...I wonder if something might be going wrong there?

-Frinny
Jul 10 '07 #5
kym
7 New Member
You should close your data reader when you are done with it to clean things up.
Could you possibly post the code for where you are assigning your "items" array to the control using the auto complete?

Have you tried declaring your items array like this:
Expand|Select|Wrap|Line Numbers
  1. Dim items() As New String
  2.  
Instead of like this:
Expand|Select|Wrap|Line Numbers
  1. Dim items As New List(Of String)
  2.  
I don't think you'll need to use items.ToArray in your return statement if you change your declaration...I wonder if something might be going wrong there?

-Frinny



I tried this and got the following error:Value of type 'String' cannot be converted to '1-dimensional array of String'.

Thanks again.
Jul 10 '07 #6
Frinavale
9,735 Recognized Expert Moderator Expert
I tried this and got the following error:Value of type 'String' cannot be converted to '1-dimensional array of String'.

Thanks again.
You need to specify a length for the Array...
Sorry I guess I wasn't thinking clearly earlier..I've just never used a List before.
I just looked it up and it looks like you're doing things correctly.

Earlier, did you mean to say that everything worked properly when you added items to the List manually..and then returned the toArray() version of this list to your calling function?
Jul 10 '07 #7
kym
7 New Member
The problem occurs because for some reason it exits the function on the following **** statement:
Expand|Select|Wrap|Line Numbers
  1.   <WebMethod()> _
  2.     Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As String()
  3.  
  4.         Dim Sql As String = "SELECT NAME from NAMELIST WHERE NAME  LIKE '" & prefixText & "' || '%' ORDER BY NAME ;"
  5.         Dim Conn As New _
  6.                OracleClient.OracleConnection(ConfigurationManager  .ConnectionStrings( _
  7.               "OrdConnectionString").ConnectionString)
  8.         ' Dim Conn As OracleConnection = New OracleConnection("Data Source=dbHazard;User ID=HazUser;Password=password")
  9.         Dim cmd As New OracleClient.OracleCommand(Sql, Conn)
  10.         Dim items As New List(Of String)
  11.   '****(exits on the following line)
  12.       Dim dr As OracleClient.OracleDataReader = cmd.ExecuteReader() ' VB.NET
  13.         While dr.Read() ' VB.NET
  14.             items.Add(dr.Item("NAME"))
  15.         End While
  16.  
  17.         'items.Add(dr.Item("NAME"))
  18.         Return items.ToArray
  19.  
  20.  
  21.  
  22.     End Function
Jul 17 '07 #8
kym
7 New Member
For some reason it is my connection string
Jul 23 '07 #9
kym
7 New Member
For anyone that needs to know, you can not use ; in sql statement with autocomplete this will cause an error. thanks for help.
Jul 24 '07 #10
Frinavale
9,735 Recognized Expert Moderator Expert
For anyone that needs to know, you can not use ; in sql statement with autocomplete this will cause an error. thanks for help.

Thanks for sharing the solution!

:D
Jul 24 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

11
2318
by: Yarco | last post by:
I want to use "Ajax" to create my web for hobby. But i don't know whether "Ajax" is mature... And what about with php? Someone have experience on it? ....
4
4290
by: bobzimuta | last post by:
I'm creating a simple AJAX library. It's an object that will return an array containing the response text or xml. I'm trying to find a way to assign the response as a property of the object, but...
0
1825
by: melledge | last post by:
Ajax Developers' Day added to XTech 2006 agenda XTech 2006 - 17-19 May - Hotel Grand Krasnopolsky - Amsterdam, The Netherlands
0
1807
by: melledge | last post by:
Ajax Developers' Day to Kick Off XTech 2006 Conference Industry experts offer insight into next generation of the Web ALEXANDRIA, VIRGINIA, USA - April 25, 2006 - In response to the rapidly...
1
16472
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX -...
10
3013
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= | last post by:
controlsPlease could some of you here post some of your live examples of AJAX (esp drag panels, collapsable panels, and popup menu.) (It's one thing to talk about how great something is, but it's...
2
2245
by: soni2926 | last post by:
hi, does anyone know of any good books on ajax and asp.net, one that teaches ajax itself before jumping in atlas? I wanted to get an understanding of ajax and how to use it, most books i've seen...
1
3390
by: shaunwo | last post by:
I'm an AJAX / DOM Novice (at best) and trying to figure out how to write the value to a couple input fields. I don't remember exactly where I got the ajax.js file I'm using from (went to the website...
11
3011
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have run into a situation that if a page/tab that uses the Ajax toolkit (using .net version 3.5) is closed before the Ajax enable controls complete loading, then IE locks up. Does it in both IE7...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.