using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class autocompletdemo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static string[] GetCompletionList(string prefixText, int count, string contextKey)
{
string cs = ConfigurationManager.ConnectionStrings["NorthwindCS"].ConnectionString;
SqlConnection cn = new SqlConnection(cs);
SqlDataAdapter da=new SqlDataAdapter("select ProductName from Products",cn);
DataSet ds = new DataSet();
da.Fill(ds, "Products");
DataView dv = new DataView(ds.Tables[0]);
dv.RowFilter = string.Format("ProductName like '{0}%'",prefixText);
int rcount, size;
rcount = dv.Count;
if (rcount >= count)
size = count;
else
size = rcount;
string[] Pnames = new string[size];
for (int i = 0; i < size; i++ )
{
Pnames[i] = dv.[i]["PoductName"].toString();
}
return Pnames;
}
}
there is error in marked line plz help mi out
Loading

Nitesh KejriwalPosted Oct 22, 2012, 7:10 AM
Pnames[i] = dv[i]["PoductName"].toString();
instead of
Pnames[i] = dv.[i]["PoductName"].toString();
There is no dot (.) after dv.
Nitesh KejriwalPosted Oct 22, 2012, 7:32 AM
Sandy SurwasePosted Oct 22, 2012, 7:19 AM