namespace MobileAPPLICATION { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button_login_Click(object sender, EventArgs e) { string _connectionstring = @"Server='.\SQLEXPRESS';Initial Catalog=LOGIN;USER ID=SA;PWD=;"; SqlConnection _connection = new SqlConnection(_connectionstring); if (txtpwd.Text == "") { MessageBox.Show("Password is empty!"); txtpwd.Focus(); } else { _connection.Open(); string _sql = "SELECT * FROM [LOGIN] where username=@username and password=@password;"; SqlCommand _command = new SqlCommand(_sql, _connection); _command.Parameters.AddWithValue("@username", txtusername.Text); _command.Parameters.AddWithValue("@password", txtpwd.Text); if (_command != null) { //commands to go to the main menu form! } else { MessageBox.Show("Invalid Username/Password!"); } } } private void button_reset_Click(object sender, EventArgs e) { txtusername.Text = ""; txtpwd.Text = ""; } private void txtusername_TextChanged(object sender, EventArgs e) { } private void txtpwd_TextChanged(object sender, EventArgs e) { } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)