winForm,解决DataGridView清空数据时把标题头一起清空
//dataGridView1.DataSource = null;//这样不行,会把标题头一起清空//以下方法可以解决DataTable dt = (DataTable)dataGridView1.DataSource;if (dt != null){dt.Rows.Clear();}dataGridView1.DataSource = dt;
//dataGridView1.DataSource = null;//这样不行,会把标题头一起清空//以下方法可以解决DataTable dt = (DataTable)dataGridView1.DataSource;if (dt != null){dt.Rows.Clear();}dataGridView1.DataSource = dt;
--数据库SQL注入攻击select count(*) from 表 where LoginID='lqwvje' and pwd='123'--拿上面的一个经常用的用户登入实例 正常情况下是没有问题 count0即可以登入成功--用户名一但输入了数据库特殊字符如一下 一段代码 那就可以正常登入select count(*) from 表 where Lo…
System.Threading.Thread th1;public void TestThread(){if (th1 == null || !th1.IsAlive){th1 = new System.Threading.Thread(要执行的方法);th1.IsBackground = true;th1.Start();}}
导出PDF报表后如下图,用黑体用不是乱码 报表默认的字体就会乱码,改成黑体、楷体_GB2312、隶书和幼圆都能正常显示
tableLayoutPanel 里面的Lable值发生变动频繁时 边框会闪动解决是在窗体加载时添加以下代码即可,本人亲自用过,很管用private void Form1_Load(object sender, EventArgs e) { //tableLayoutPanel1 是控件的名称tableLayoutPanel1.GetType().GetProperty("DoubleBuffer…
下面是一个代码实例 static void Main() {Console.WriteLine("-------主线程启动-------");GetStrLengthAsync();Console.WriteLine("主线程继续执行");Console.WriteLine("-------主线程结束-------");Console.Read(); } static async void Get…
在.net core使用GB2312时抛出以下异常 System.ArgumentException:“'gb2312' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. 解决方法 在NuGet 添加“System.Text.Enco…
在这里我封装好了一个类 import android.content.Context; import android.widget.Toast;public class ToastUtil {private static Toast mToast;public static void ShowMsg(Context context, String msg,int duration) {if (mToast == null) {mToast = Toast.makeText(contex…
有些软件不想在同一台电脑上运行两个可以用以下方法在Program.cs类里面写上以下代码即可/// <summary>/// 应用程序的主入口点。/// </summary>[STAThread]static void Main(){bool ret;System.Threading.Mutex mutex = new System.Threading.Mutex(true, Applicat…
今晚搞了一晚,终于解决了insert into hbc_mainData ( worklist,biaoshi ) values ('11111111133333333333','000')存到数据库后的数据分别是 1.1111111133333334e+19 和 0主要因素是我数据库数据类型不对搞成的 解决方案是把string(50)改成Text 或其它varchar类型都可以查阅…