.Net 文本框实现内容提示的实例代码(仿Google、B(5)


        /// <summary>
        /// 删除 ceshi 列表
        /// </summary>
        /// <param></param>
        /// <param></param>
        /// <returns></returns>
        public bool DeleteCeshiList(List<Ceshi> lstCeshi, out string sErr)
        {


            sErr = "";
            int ii = 0;
            bool bRet = true;
            try
            {

using (TransactionScope sc = new TransactionScope())
                {
                    //如果生成扩展类请使用Delete()方法方法
                    foreach (Ceshi bedelmode in lstCeshi)
                    {
                        ii++;
                        Ceshi.Delete(bedelmode.GetPrimaryKeyValue());

//LogHelper.WriteLog(logType.删除 , logModule.Deptrelation,"ceshi删除成功("+bedelmode.GetPrimaryKeyValue().ToString()
                        //+")!");
                    }
                    sc.Complete();
                }
            }
            catch (Exception ex)
            {
                sErr = "ceshi删除不成功!";
                return false;
            }

sErr = "共" + ii.ToString() + "条单据删除成功!";
            return bRet;


        }

public  void GetTopUserName(int topCount, string name, out List<string> listId, out  List<string> listcname)
        {
            string sql = string.Format(@"Select id,cname from(Select ROW_NUMBER() over(order by cname)as ROWNUM," +
                "id,cname FROM [dbo].[Ceshi] where cname like '%" + name + "%' or  dbo.f_GetPy(cname) like '%" + name + "%') as ta where ta.ROWNUM <= " + topCount);
            DataTable dt = new DataTable();
            QueryCommand qc = new InlineQuery().GetCommand(sql);
            dt = DataService.GetDataSet(qc).Tables[0];//将查询出来的数据集放到List中去(查询数据的方法,有很多,这边我用的是Subsonic类自带的查询方法)
            listcname = new List<string>();
            listId = new List<string>();
            foreach (DataRow row in dt.Rows)
            {

listId.Add(row[0].ToString());
                listcname.Add(row[1].ToString());

}

}

#endregion

}
}

7.webconfig配置

复制代码 代码如下:


<?xml version="1.0"?>

<!--
  有关如何配置 ASP.NET 应用程序的详细信息,请访问
  ?LinkId=169433
  -->

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjzxfw.html