小贴笔记 自己看
sql语句实现for循环
此帖为我开发过程中的一些小笔记---- 很零碎,很简单!
(1)在.net的sql语句中引.net代码的字段
如果a对应的字段是string型则
com.CommandText = "select * form -----where --- = '"+a+"'";
如果a对应的字段是int型则
"select * form -----where --- ="+a;
(2)在.net的sql 语句中引用页面的字段
例如:
string strsql="select * from mytable where f_AttDate between '"+ TextBox1.Text.Trim() +"' and '"+ TextBox2.Text.Trim() +"' "
给自己看得语句 自己写的
select top 5 count(VirusName) as ge ,isnull(nullif(ltrim(rtrim(VirusName)),''),'未知数据') VirusName from Table_Virus group by VirusName order by ge desc
select count(*) as ge,VirusName='其他病毒' from Table_Virus where VirusName not in(select top 5 VirusName from Table_Virus group by VirusName order by count(1) desc)
两个DataTable中表结构相同的话,用Merge方法
DataTable1.Merge(DataTable2),这样就把两个表合并了.