winform excel导入mysql_C#winform中Excel电子表格导入数据库示例

//调用上面的函数ds=xsldata(filepath);//dataGridView2.DataSource = ds.Tables[0];interrorcount=0;//记录错误信息条数intinsertcount=0;//记录插入成功条数intupdatecount=0;//记录更新信息条数for(inti=0; i

{intcardtypeid=Convert.ToInt32(ds.Tables[0].Rows[i][0].ToString());stringcardnum=ds.Tables[0].Rows[i][1].ToString();stringcardpwd=ds.Tables[0].Rows[i][2].ToString();intofficeid=Convert.ToInt32(ds.Tables[0].Rows[i][3].ToString());

DateTime  stdt=Convert.ToDateTime(ds.Tables[0].Rows[i][4].ToString());stringcardstate=ds.Tables[0].Rows[i][5].ToString();intuserid=Convert.ToInt32(ds.Tables[0].Rows[i][6].ToString());if(cardtypeid!=0&&cardnum!=""&&cardpwd!=""&&userid!=0)

{

SqlCommand selectcmd=newSqlCommand("select count(*) from cardsinfo where CardNum='"+cardnum+"'and CardPwd='"+cardpwd+"' and C

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值