Example #1
0
        public static string note        = "签名成功";              //注释
        /// <summary>
        /// 最后将签名结果插入到数据库
        /// </summary>
        public static void inster()
        {
            //建立数据库链接
            SqlConnection mysql = new SqlConnection();

            //链接字符串类
            getSqlStr sqlStr = new getSqlStr();
            //获取链接字符串
            string str = sqlStr.sqlstr();

            //
            mysql.ConnectionString = str;
            //打开连接
            mysql.Open();

            try
            {
                //MessageBox.Show(maxID + "'\r\n,'"+sequence+"'\r\n,'" + first + "'\r\n," + begintime + "\r\n," + endtime +"\r\n,'" +message + "'\r\n,'" + sequence+"'\r\n,'"+time+"'\r\n,'" + note+"'\r\n,'"+ingtime+"'");
                string     ist    = "insert into history  values(" + maxID + ",'" + sequence + "','" + first + "','" + begintime.ToString("yyyy-MM-dd HH:mm:ss") + "','" + endtime.ToString("yyyy-MM-dd HH:mm:ss") + "','" + message + "','" + sequence + "','" + time + "','" + note + "','" + ingtime + "')";
                SqlCommand insert = new SqlCommand(ist, mysql);

                insert.ExecuteNonQuery();//执行sql语句并返回影响的行数
            }
            catch (Exception t)
            {
                MessageBox.Show(t.ToString());
            }
        }
Example #2
0
File: userPK.cs Project: radtek/KGC
        private void userpkdate()
        {
            dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders;
            getSqlStr ss  = new getSqlStr();
            string    sql = ss.sqlstr();
            //连接数据库
            SqlConnection myCon = new SqlConnection();

            try
            {
                myCon.ConnectionString = sql;
                myCon.Open();
            }
            catch (Exception e)
            {
                MessageBox.Show("服务器“userpk窗体”异常 1:" + e.Message);
            }
            //使用SqlCommand提交查询命令
            string     selStr = "select ID as 用户ID,userpk as 用户名 from userpk";
            SqlCommand sel    = new SqlCommand(selStr, myCon);
            //获取数据适配器
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = sel;
            //填充dataset
            DataSet   ds = new DataSet();
            DataTable dt = new DataTable();

            da.Fill(dt);
            //将dataset中的数据绑定到

            this.dataGridView1.DataSource = dt.DefaultView;
        }
Example #3
0
        public static string ss()
        {
            getSqlStr s = new getSqlStr();

            return(s.sqlstr());
        }