本文整理汇总了C#中DataClasses1DataContext.ExecuteCommand方法的典型用法代码示例。如果您正苦于以下问题:C# DataClasses1DataContext.ExecuteCommand方法的具体用法?C# DataClasses1DataContext.ExecuteCommand怎么用?C# DataClasses1DataContext.ExecuteCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataClasses1DataContext
的用法示例。
在下文中一共展示了DataClasses1DataContext.ExecuteCommand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Publish_Click
protected void Publish_Click(object sender, EventArgs e)
{
using (var db = new DataClasses1DataContext())
{
db.ExecuteCommand("DELETE FROM YasaiKensa WHERE No IN (SELECT No FROM Temp_YasaiKensa);");
db.ExecuteCommand("INSERT INTO YasaiKensa SELECT * FROM Temp_YasaiKensa;");
db.ExecuteCommand("DELETE FROM Temp_YasaiKensa");
}
Response.Redirect("complete.aspx");
}
示例2: btnDeleteAll_Click
private void btnDeleteAll_Click(object sender, EventArgs e)
{
DataClasses1DataContext dc = new DataClasses1DataContext();
if (DialogResult.Yes == MessageBox.Show("Delete all StreamMoments?", "Warning", MessageBoxButtons.YesNo))
{
logger.Info("Starting User requested StreamMoment wipe.");
dc.ExecuteCommand("Delete from StreamMoments");
logger.Info("Completed User requested StreamMoment wipe.");
}
}
示例3: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
using (SpreadsheetDocument doc = SpreadsheetDocument.Open(FileUpload1.FileContent, false))
{
var map = ExcelUtil.GetMap(doc, "追加分データ");
var xx = map.GetLength(0);
var yy = map.GetLength(1);
using (var db = new DataClasses1DataContext())
{
db.ExecuteCommand("DELETE FROM Temp_YasaiKensa");
foreach (var yn in db.YasaiName)
{
if (yn.大分類名 != null && !yn.大分類名.IsNormalized(System.Text.NormalizationForm.FormC))
{
yn.大分類名 = yn.大分類名.Normalize(System.Text.NormalizationForm.FormC);
}
if (yn.中分類名 != null && !yn.中分類名.IsNormalized(System.Text.NormalizationForm.FormC))
{
yn.中分類名 = yn.中分類名.Normalize(System.Text.NormalizationForm.FormC);
}
//if (yn.品目 != null && !yn.品目.IsNormalized(System.Text.NormalizationForm.FormC))
//{
// yn.品目 = yn.品目.Normalize(System.Text.NormalizationForm.FormC);
//}
if (yn.別名 != null && !yn.別名.IsNormalized(System.Text.NormalizationForm.FormC))
{
yn.別名 = yn.別名.Normalize(System.Text.NormalizationForm.FormC);
}
if (yn.補正 != null && !yn.補正.IsNormalized(System.Text.NormalizationForm.FormC))
{
yn.補正 = yn.補正.Normalize(System.Text.NormalizationForm.FormC);
}
}
var namedic = db.YasaiName.Select(x => new
{
品目 = x.品目.Normalize(System.Text.NormalizationForm.FormC).Trim(),
大分類名 = x.大分類名.Trim(),
中分類名 = x.中分類名.Trim(),
別名 = x.別名.Trim(),
補正 = x.補正.Trim(),
}).ToList();
for (int y = 0; y < yy; y++)
{
int temp;
if (Int32.TryParse(Convert.ToString(map[2, y]), out temp))
{
var item = new Temp_YasaiKensa()
{
No = Convert.ToInt32(map[2, y]),
実施主体 = Convert.ToString(map[3, y]),
産地都道府県 = Convert.ToString(map[4, y]),
産地市町村 = Convert.ToString(map[5, y]),
農場採取流通品 = Convert.ToString(map[6, y]),
食品カテゴリ = Convert.ToString(map[7, y]),
品目 = Convert.ToString(map[8, y]),
検査機関 = Convert.ToString(map[9, y]),
採取日 = Convert.ToString(map[10, y]).ToDate(),
結果判明日 = Convert.ToString(map[11, y]).ToDate(),
厚生省発表日 = Convert.ToString(map[12, y]).ToDate(),
結果ヨウ素131 = Convert.ToString(map[13, y]),
結果セシウム134 = Convert.ToString(map[14, y]),
結果セシウム137 = Convert.ToString(map[15, y]),
結果セシウム = Convert.ToString(map[16, y]),
};
#region Normalize
//品目名
if (!item.品目.IsNormalized(System.Text.NormalizationForm.FormC))
{
item.品目 = item.品目.Normalize(System.Text.NormalizationForm.FormC);
}
decimal tmp;
if (Decimal.TryParse(item.結果ヨウ素131, out tmp))
{
if (item.ヨウ素131D != tmp)
{
item.ヨウ素131D = tmp;
}
}
else if (item.結果ヨウ素131 == "ND")
{
if (item.ヨウ素131D != 0)
{
item.ヨウ素131D = 0;
}
}
else
{
if (item.ヨウ素131D != null)
{
item.ヨウ素131D = null;
}
//.........这里部分代码省略.........