Here is my code
MinimumPrefixLength="2" UseContextKey="false">
AutoComplete.asmx
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Collections.Generic;
using System.Web.Script.Services;
using System.Data;
using Businesslogic;
[System.Web.Script.Services.ScriptService]
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
public class AutoComplete : System.Web.Services.WebService
{
[WebMethod]
public string[] GetPartyName(string prefixText)
{
Businesslogic.BLInquiry objInq;
objInq = new BLInquiry();
//MySQLConnection con = new MySQLConnection();
// string qry = "SELECT column_name FROM table_name WHERE column_name LIKE '%" + prefixText + "%' ";
DataSet ds = new DataSet();
ds = objInq.GetPartyName(prefixText);
string[] items = new string[ds.Tables[0].Rows.Count];
int i = 0;
try
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
items.SetValue(dr["PartyName"].ToString(), i);
i++;
}
}
catch (Exception err)
{
throw err;
}
return items; //i m getting all the item in array
}
}
Please tell me what's wrong with my code.
Satish BhatPosted Jul 28, 2011, 6:05 AM
Satish BhatPosted Jul 28, 2011, 7:46 AM
yogita dhingraPosted Jul 28, 2011, 6:26 AM
yogita dhingraPosted Jul 28, 2011, 5:31 AM
Satish BhatPosted Jul 28, 2011, 5:14 AM
Also test the Web service in a browser to see it is returning values.