autoComplete1.ServiceMethod = objdpt.LoadDpt(prefix);
aspx.cs
文件代码..调用loaddpt
函数
public string LoadDpt(string prefixtext)
{
//Functionality : AutoComplete The DepartmentName
ArrayList arlSample = new ArrayList();
arlSample = objDataAccess.GetSingleColumn("QRY_DeptName", prefixtext);
return arlSample;
//string[] strArray = arlSample.ToArray(typeof(string)) as string[];
}
上面是bll文件代码。调用getsinglecolum
函数
public ArrayList GetSingleColumn(string strQuery, params object[] objValueList)
{
ArrayList arlData = new ArrayList();
try
{
string strQry;
strQry = ReadXmlvalue(strQuery, objValueList);
cmdHrm = new OleDbCommand();
cmdHrm.Connection = conHrmDb;
if (conHrmDb.State == ConnectionState.Closed)
conHrmDb.Open();
cmdHrm.CommandText = strQry;
drdHrm = cmdHrm.ExecuteReader();
while (drdHrm.Read())
{
arlData.Add(drdHrm.ToString());
}
return arlData;
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (conHrmDb.State == ConnectionState.Open)
conHrmDb.Close();
}
}
上面是dal文件代码。
我想将字符串返回aspx.cs
file..help plz
答案 0 :(得分:0)
如果要将ArrayList转换为字符串数组,可以使用:
IEnumerable<string> strings = arlSample.Cast<string>();
string[] result = strings.ToArray();
如果你想连接所有元素,那么你可以返回一个你应该使用的字符串:
string resultString = String.Concat(strings);