お世話になります。
パスワードを管理するシステムのログイン画面を実装しております。
そこで、DBから取ったデータをテキストボックスの入力値と比較したいのですがうまくいきません。
ご教示の程のよろしくお願い致します。
コメントの //SELECT文結果取得(ID)部分です。
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SQLite; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication4 { public partial class Login : Form { public Login() { InitializeComponent(); } public void buttonLogin_Click(object sender, EventArgs e) { string dbConnectionString = "Data Source = C:\\Users/myfriend.sqlite3"; using (SQLiteConnection cn = new SQLiteConnection(dbConnectionString)) { cn.Open(); using (SQLiteTransaction trans = cn.BeginTransaction()) { SQLiteCommand cmd = cn.CreateCommand(); //ログインマスターSELECT cmd.CommandText = "select ID from LOGIN"; using (SQLiteDataReader reader = cmd.ExecuteReader()) { //SELECT文結果取得(ID) var a = reader; var b = a.ToString(); //IDの一致判断 if (textLogin.Text == b) { } } cmd.CommandText = "select PW from LOGIN"; using (SQLiteDataReader reader = cmd.ExecuteReader()) { //SELECT文結果取得(PW) var PW = reader; } cn.Close(); } } //登録画面に遷移 Touroku Touroku = new Touroku(); Touroku.Show(); //ログイン画面を閉じる this.Visible = false; } private void buttonMaster_Click(object sender, EventArgs e) { Master Master = new Master(); Master.Show(); this.Visible = false; } private void Login_Load(object sender, EventArgs e) { this.ActiveControl = this.textLogin; } private void textLogin_TextChanged(object sender, EventArgs e) { } } }
ASP.NET のタグがついていますが、コードを見ると Login : Form と Windows Forms アプリのように見えます。どっちなんですか?
回答1件
あなたの回答
tips
プレビュー