Пример #1
0
        //Excel表中的列名和数据库中的列名一定要对应
        private void insertToSql_stu(DataRow dr)
        {
            string account   = dr["账号"].ToString();
            string password  = dr["密码"].ToString();
            string name      = dr["姓名"].ToString();
            string sex       = dr["性别"].ToString();
            string id        = dr["学号"].ToString();
            string grade     = dr["年级"].ToString();
            string major     = dr["专业"].ToString();
            string Class     = dr["班别"].ToString();
            string phone     = dr["电话号码"].ToString();
            string email     = dr["邮箱地址"].ToString();
            string introduce = dr["自我介绍"].ToString();
            string academy   = dr["学院"].ToString();
            string groupID   = dr["团队编号"].ToString();

            SQLDBhelper.ExecuteNonQuery(string.Format("insert into stupasswordtable values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}')", account, password, name, sex, id, grade, major, Class, phone, email, introduce, academy, groupID));
        }
Пример #2
0
        //Excel表中的列名和数据库中的列名一定要对应
        private void insertToSql_tea(DataRow dr)
        {
            string Account     = dr["账号"].ToString();
            string Password    = dr["密码"].ToString();
            string Name        = dr["姓名"].ToString();
            string Sex         = dr["性别"].ToString();
            string ID          = dr["工号"].ToString();
            string Position    = dr["职称"].ToString();
            string Number      = dr["名额"].ToString();
            string groupnumber = dr["名额"].ToString();
            string Phone       = dr["电话号码"].ToString();
            string Email       = dr["邮箱地址"].ToString();
            string Academy     = dr["学院"].ToString();
            string Research    = dr["研究方向"].ToString();
            string grade       = dr["年级"].ToString();
            string major       = dr["专业"].ToString();

            SQLDBhelper.ExecuteNonQuery(string.Format("insert into teapasswordtable values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}')", Account, Password, Name, Sex, ID, Position, Number, groupnumber, Phone, Email, Academy, Research, grade, major));
        }