|
| jorge08 : On May 11, 2008 8:05 PM said: |
Hi Joe, maybe you have a sample about this control using a database?
|
|
|
| warrenvt : On June 02, 2008 1:50 PM said: |
Hi Joe,
I have an external web service that has been created for me to allow me access to a db. How can I use the AJAX to connect to this web service?
|
|
|
| Gabriel82 : On June 07, 2008 8:44 AM said: |
Jorge08 this is a small example with Access Database:
If (count = 0) Then
count = 10
End If
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("App_Data/ExpImpdb.mdb") & ";"
Dim adp As New System.Data.OleDb.OleDbDataAdapter("select * from cars WHERE RecMerk Like '" & prefixText & "%' ", strConn)
Dim dt As New System.Data.DataTable
adp.Fill(dt)
Dim items As New List(Of String)
For i As Integer = 0 To dt.Rows.Count
Dim datafile
datafile = UCase(dt.Rows(i).Item("RecMerk"))
i += 1
items.Add(datafile)
Next
Return items.ToArray()
|
|
|
| Sabeltann : On June 20, 2008 7:38 AM said: |
Thanks Joe! I've wanted to try making an AJAX control like this for a while, but always thought it'd be more complex - you made it look easy.
From a beginner's viewpoint it wasn't obvious to me that when creating the webmethod, you can change the webmethod name as you like but the parameter names _must_ be prefixText and count (but maybe that's me being dumb)
It seems pretty easy to hook this up to a database using LINQ. If it's of any help, here's my code to query product names in Northwind, (assumes you've already made the linq to northwind class)
[WebMethod]
public string[] GetCompletionList(string prefixText, int count)
{
// OBS! In real world, initialize this someplace else
NorthwindDataContext Db = new NorthwindDataContext();
var matches = from p in Db.Products
where p.ProductName.StartsWith(prefixText)
select p.ProductName;
return matches.ToArray<string>();
}
|
|
|
| sudheshna : On July 09, 2008 6:59 AM said: |
Hi Joe,
I tried the code and is working fine but when I implemented URL rewriting its displaying a js error 'Syntax error' and the auto complete is not working its displaying results as undefined. If I remove the code
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="AutoComplete.asmx" />
</Services>
</asp:ScriptManager>
there is no js error. I'm using C# and the auto complete text box is filled from DB. How can I solve this issue. Please help.
Thanks
|
|
|
| Scorpiogenie : On July 11, 2008 10:40 PM said: |
Hi Joe, I just wanted to say thanks. I’m interning with Goldman Sachs- Tech Division. Your videos have saved my life on numerous occasions. You are appreciated.
|
|
|
| Jagarm : On July 17, 2008 2:01 PM said: |
Hello Joe,
I have downloaded your VB code and try to run it on my computer, it does work in firefox but doesn't work in IE6 and up. The example about the autocomplete that is on Ajax Toolkit live page works with all platform. Any suggestion here?
Thanks
Jagar,
|
|
|
| dummies2 : On July 18, 2008 2:24 PM said: |
when i tried to use this example and get info out of my database it keeps telling me that my variable.toarray is wrong and gives me an error of type'1-dimensional array of string cannot be converted to string??? why is that?
here is my code please help.
Dim dtst As DataTable
Dim sqlconnection As SqlConnection = New SqlConnection("connectionstring")
Dim objcmd As SqlCommand = New SqlCommand("select namefrom students where name like '" + prefixTex + "%' ", sqlconnection)
sqlconnection.Open()
Dim sqladpt As SqlDataAdapter = New SqlDataAdapter
sqladpt.SelectCommand = objcmd
sqladpt.Fill(dtst)
Dim cntname As List(Of String)
For i As Integer = 0 To dtst.Rows.Count
Dim datafile
datafile = UCase(dtst.Rows(i).Item("description"))
i += 1
cntname.Add(datafile)
Next
Return cntname.ToArray
thank you in advnace
|
|
|
| dummies2 : On July 18, 2008 2:26 PM said: |
there should be a space between name and form but the error is from cntname.toarray.
|
|
|
| dummies2 : On July 18, 2008 2:27 PM said: |
sorry i was typing too fast the line
dtatfile=ucase(dtst.rows(i).item("description")
should be
dtatfile=ucase(dtst.rows(i).item("name")
|
|
|
| dummies2 : On July 18, 2008 3:13 PM said: |
got it there was a mistake on the public function (prefixtex as string) as string() but the textbox doesnt work. it doesn't autocomplete
|
|