linq 查詢 Linq 高級查詢實(shí)例代碼
[code]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text.RegularExpressions;
using System.IO;
using System.Text;
using System.Data;
namespace SJLERP
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Dictionary<string, string> cityAndNum =
Regex.Matches(City.data, @"[^\r].*?\r")
.Cast<Match>()
.Select(c => Regex.Replace(c.Value, @"\s", ""))
.Aggregate(new Dictionary<string, string>(), (reval, item) =>
{
if (Regex.IsMatch(item, @"[\u4e00-\u9fa5]+\d+"))
{
string word = Regex.Match(item, @"[\u4e00-\u9fa5]+").Value;
string num = Regex.Match(item, @"\d+").Value;
reval.Add(word, num);
}
return reval;
});
ADOHelper.ExecuteCommand("create table KaixuanTest ( city varchar(max),num varchar(max) ) ");
cityAndNum.ToList().ForEach(c =>
{
string sql = string.Format(" insert KaixuanTest select '{0}','{1}'",c.Key,c.Value);
ADOHelper.ExecuteCommand(sql);
});
}
}
}
相關(guān)文章
ASP.NET MVC5網(wǎng)站開發(fā)管理列表、回復(fù)及刪除(十三)
這篇文章主要介紹了ASP.NET MVC5網(wǎng)站開發(fā)實(shí)現(xiàn)管理列表、回復(fù)及刪除,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2015-09-09ASP.NET Core設(shè)置URLs的方法匯總(完美解決.NET 6項(xiàng)目局域網(wǎng)IP地址遠(yuǎn)程無法訪問的
近期在dotnet項(xiàng)目中遇到這樣的問題.net6 運(yùn)行以后無法通過局域網(wǎng)IP地址遠(yuǎn)程訪問,整理出解決問題的五種方式方法,感興趣的朋友一起看看吧2023-11-11ASP.NET?Core設(shè)置Ocelot網(wǎng)關(guān)限流
這篇文章介紹了ASP.NET?Core設(shè)置Ocelot網(wǎng)關(guān)限流的方法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-04-04ASP.NET Core 集成 React SPA應(yīng)用的步驟
這篇文章主要介紹了ASP.NET Core 集成 React SPA應(yīng)用的步驟,幫助大家更好的理解和學(xué)習(xí)使用.net技術(shù),感興趣的朋友可以了解下2021-04-04