i figured it out, autocomplete extender automatically sends two variables to the WebService, string prefixText, int count, even though the Webservice doesnt need the,. so i changed the asmx to this
<%@ WebService Language="C#" Class="WebService" %> using System; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Data; using System.Collections.Generic; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.Web.Script.Services.ScriptService] public class WebService : System.Web.Services.WebService { [WebMethod(Description = "Input a Player")] public string[] GetPlayer(string prefixText, int count)<------ Notice here { //Initialize data access class used in MIS 324 (written in VB.NET) string strSQL = "Select nameFirst, nameLast from FullMaster where (nameFirst LIKE '" + prefixText + "%') or (nameLast like '" + prefixText + "%')"; BaseballAccess objDataAccess = new BaseballAccess ("BaseballDatabase"); DataTable dt = new DataTable(); dt = objDataAccess.FillDataTable(strSQL); //Note: web services can return DataSets but not DataTables. List<string> items = new List<string>(dt.Rows.Count); foreach (DataRow dr in dt.Rows) { string c1 = Convert.ToString(dr["nameFirst"]) + " " + Convert.ToString(dr["nameLast"]); items.Add(c1); } return items.ToArray(); } } and it worked fine funny because there is no documentation for this. On Jun 1, 7:01 am, The_Fruitman <[email protected]> wrote: > If you run this in Debug mode what is the value of the variable that > you're passing to the service? > > Use this site as a reference to help > you:http://www.davidhayden.com/blog/dave/archive/2007/10/22/ASPNETAJAXAut... > > On May 31, 12:50 pm, isaac2004 <[email protected]> wrote: > > > can someone please help ive tried everything > > > On May 27, 11:45 am, isaac2004 <[email protected]> wrote: > > > > I posted this earlier but never got a response, I have a WebService > > > that pulls info from a DB. I then have an ajax autocomplete textbox > > > that grabs this info from the WebService. In firebug, i get 500 error > > > reading this > > > > {"Message":"Invalid web service call, missing value for parameter: > > > \u0027query\u0027.","StackTrace":" > > > at System.Web.Script.Services.WebServiceMethodData.CallMethod > > > (Object target, IDictionary`2 parameters > > > )\r\n at > > > System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams > > > (Object target, IDictionary > > > `2 parameters)\r\n at > > > System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext > > > context, WebServiceMethodData > > > methodData, IDictionary`2 rawParams)\r\n at > > > System.Web.Script.Services.RestHandler.ExecuteWebServiceCall > > > (HttpContext context, WebServiceMethodData > > > methodData)","ExceptionType":"System.InvalidOperationException" > > > > } > > > > the webservice works fine when ran by itself, so i figure its a small > > > mistake i am having, below is the aspx and the asmx page > > > > ASMX > > > <%@ WebService Language="C#" Class="WebService" %> > > > using System; > > > using System.Web; > > > using System.Web.Services; > > > using System.Web.Services.Protocols; > > > using System.Data; > > > using System.Collections.Generic; > > > [WebService(Namespace = "http://tempuri.org/")] > > > [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] > > > [System.Web.Script.Services.ScriptService] > > > public class WebService : System.Web.Services.WebService > > > { > > > [WebMethod(Description = "Input a string and this will return all > > > the players with that string in their names")] > > > > public string[] GetPlayer(string query) { > > > > string strSQL = "Select nameFirst, nameLast from FullMaster > > > where (nameFirst LIKE '" + query + "%') or (nameLast like '" + query + > > > "%')"; > > > DataAccess objDataAccess = new DataAccess("BaseballDatabase"); > > > DataTable dt = new DataTable(); > > > dt = objDataAccess.FillDataTable(strSQL); > > > //Note: web services can return DataSets but not DataTables. > > > List<string> items = new List<string>(dt.Rows.Count); > > > foreach (DataRow dr in dt.Rows) > > > { > > > string c1 = Convert.ToString(dr["nameFirst"]) + " " + > > > Convert.ToString(dr["nameLast"]); > > > items.Add(c1); > > > > } > > > return items.ToArray(); > > > } > > > > } > > > > ASPX page > > > > <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" > > > %> > > > > <%@ Register Assembly="AjaxControlToolkit" > > > Namespace="AjaxControlToolkit" TagPrefix="cc1" %> > > > > <script runat="server"> > > > > </script> > > > > <asp:Content ID="Content1" ContentPlaceHolderID="MainForm" > > > Runat="Server"> > > > <asp:ScriptManager ID="ScriptManager1" runat="server"> > > > <Services> > > > <asp:ServiceReference Path="Player.asmx" /> > > > </Services> > > > </asp:ScriptManager> > > > <asp:TextBox ID="TextBox1" runat="server" Height="45px" > > > Width="312px"></asp:TextBox> > > > <cc1:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" > > > runat="server" > > > TargetControlID="TextBox1" ServicePath="Player.asmx" > > > ServiceMethod="GetPlayer" MinimumPrefixLength="3" > > > > </cc1:AutoCompleteExtender> > > > <br /><br /><br /> > > > </asp:Content> > > > > I would greatly appreciate some help, thanks for all that you guys do- > > > Hide quoted text - > > > - Show quoted text -
