国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

數據庫表中讀取信息

2024-07-21 02:51:32
字體:
來源:轉載
供稿:網友

//存入

string con = "Server=.;Database=UsersInfo;integrated security=SSPI";

SqlConnection mycon = new SqlConnection(con);            mycon.Open();            using (SqlCommand cmd = mycon.CreateCommand())            {                cmd.CommandText = "select * from loginInfo where Account='" + account + "'";                SqlDataReader reader = cmd.ExecuteReader();                if (!reader.Read())                {                    reader.Close();                    cmd.CommandText = "insert into loginInfo(Account,PassWord) values('" + account + "','" + passwordonce + "')";                    cmd.ExecuteNonQuery();                    MessageBox.Show("注冊成功");                    this.Close();                }                else                {                    MessageBox.Show("帳號已存在");                }            }            con.Clone();

//讀取

string con;            con = "Server=.;Database=UsersInfo;integrated security=SSPI";            SqlConnection mycon = new SqlConnection(con);            mycon.Open();            using (SqlCommand cmd = mycon.CreateCommand())            {                cmd.CommandText = "select * from loginInfo where Account='" + account + "'";                using (SqlDataReader reader = cmd.ExecuteReader())                {                    if (reader.HasRows)                    {                        if (reader.Read())                        {                            string Password = reader.GetString(reader.GetOrdinal("Password"));                            if (password == Password)                            {                                MessageBox.Show("登陸成功");                                mycon.Close();                                writeInPas();                                //儲存當前帳號                                StreamWriter sw = new StreamWriter(application.StartupPath + "//tmpAccount.txt", false);                                sw.WriteLine(txtAccountLgn.Text);                                sw.Close();                                this.DialogResult = DialogResult.OK;                            }                            else                            {                                MessageBox.Show("用戶名或密碼錯誤");                            }                        }                    }                    else                    {                        MessageBox.Show("用戶名或密碼錯誤");                    }                }            }


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 沭阳县| 凌海市| 延边| 阳春市| 横峰县| 偏关县| 从化市| 东台市| 尼木县| 长沙县| 边坝县| 阿坝| 肇东市| 安宁市| 九寨沟县| 南通市| 克什克腾旗| 永靖县| 天峻县| 宜兰县| 双柏县| 平凉市| 明溪县| 陇川县| 洱源县| 新竹县| 裕民县| 柏乡县| 临汾市| 花莲市| 都兰县| 乐清市| 太白县| 吉木乃县| 余干县| 本溪| 托克逊县| 淮南市| 西平县| 郓城县| 姚安县|