注册 登录
编程论坛 VC.NET论坛

VS.NET自动生成SQL语句问题

黑夜轮回 发布于 2017-03-30 08:37, 3814 次点击
我编辑了一段代码,将EXCLE表格导入到数据库中,但是每一条数据的第一列都导入不进去,其他列都能成功,代码如下:
#region 新增資料
        public void AddReconds(DataTable dt , int index)
        {
            try
            {
                MODEL.JC_JCDate jd = new MODEL.JC_JCDate();
                dt.Rows[index][0] = SHARE.Sys.SetDisplayString("成功", "green");
                jd.gonghao = dt.Rows[index][2].ToString();
                jd.name = dt.Rows[index][3].ToString();
                jd.bumen = dt.Rows[index][4].ToString();
                jd.kebie = dt.Rows[index][5].ToString();
                jd.xianbie = dt.Rows[index][6].ToString();
                jd.zc_start = dt.Rows[index][7].ToString();
                jd.zc_end = dt.Rows[index][8].ToString();
                jd.wc_start = dt.Rows[index][9].ToString();
                jd.wc_end = dt.Rows[index][10].ToString();
                jd.yc_start = dt.Rows[index][11].ToString();
                jd.yc_end = dt.Rows[index][12].ToString();
                jd.beizhu = string.Empty;
                jd.banbie = dt.Rows[index][14].ToString();
                Acclib.AcctLib_op.SaveChange(jd , Acclib.Options.ActionType.Add);
               
                GetSource = dt;
            }
            catch (Exception ex)
            {
                if (dt.Rows.Count > 0)
                {
                    dt.Rows[index][0] = SHARE.Sys.SetDisplayString("失敗", "red");
                    dt.Rows[index][1] = SHARE.Sys.SetDisplayString("解析錯誤", "red");
                    GetSource = dt;
                }

               
            }
        }
        #endregion
1 回复
#2
jm1094sd2023-03-30 08:51
1