Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Contributor
3051 Points
714 Posts
Dec 27, 2011 10:39 AM|LINK
Hi,
Please find my Modified method here. Please make a try and let us know the reult. However it is not tested.
public string[] GetClientName(string prefixText, int count, ref string strErrorMessage) { strErrorMessage = ""; try { objBMAutoComplete.SearchString = prefixText; objBMAutoComplete.RequestFrom = "CL"; objBMAutoComplete.SearchFor = "NAME";
DataSet dataSet = objBMAutoCompleteManager.GetINCAutoSearchData(objBMAutoComplete); List<string> items = new List<string>(dataSet.Tables[0].Rows.Count);
if (dataSet.Tables[0] != null) { for (int i = 0; i <= dataSet.Tables[0].Rows.Count - 1; i++) { if (!items.Contains(dataSet.Tables[0].Rows[i]["DisplayName"].ToString().Trim())) items.Add(dataSet.Tables[0].Rows[i]["DisplayName"].ToString().Trim()); } } return items.ToArray(); } catch (SoapException ex) { strErrorMessage = ex.Message; return null; } }
kuber.manral
Contributor
3051 Points
714 Posts
Re: Cannot implicitly convert type 'string' to 'string[]'
Dec 27, 2011 10:39 AM|LINK
Hi,
Please find my Modified method here. Please make a try and let us know the reult. However it is not tested.
public string[] GetClientName(string prefixText, int count, ref string strErrorMessage)
{
strErrorMessage = "";
try
{
objBMAutoComplete.SearchString = prefixText;
objBMAutoComplete.RequestFrom = "CL";
objBMAutoComplete.SearchFor = "NAME";
DataSet dataSet = objBMAutoCompleteManager.GetINCAutoSearchData(objBMAutoComplete);
List<string> items = new List<string>(dataSet.Tables[0].Rows.Count);
if (dataSet.Tables[0] != null)
{
for (int i = 0; i <= dataSet.Tables[0].Rows.Count - 1; i++)
{
if (!items.Contains(dataSet.Tables[0].Rows[i]["DisplayName"].ToString().Trim()))
items.Add(dataSet.Tables[0].Rows[i]["DisplayName"].ToString().Trim());
}
}
return items.ToArray();
}
catch (SoapException ex)
{
strErrorMessage = ex.Message;
return null;
}
}
Visit My Blog