06-08-19, 02:07 AM
السلام عليكم _اعمل علي مشروع ولدي شاشة دخول وشغالة بس اريد جعلها حساسة لحالة الاحرف في خانة اليوزر نيم و الباسويرد (مرفق لكم الكود البرمجي) _ استخدم لغة (C#.net) ولدي جدول باسم (Admin_log) في قاعدة بيانات (loacl host /PHPmyAdmin) ارجووووووووو المساعدة ؟ وشكرا
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace BioMetrixCore
{
public partial class fm_login : Form
{
public static class GlobaVar
{
public static string log_user;
}
public string myConnectionString = "server=127.0.0.1;uid=root;" +
"pwd=zxcvbnm@12345 ; database=f_print ; SslMode=none ";
//TpAiDn2019
//zxcvbnm@12345
int count = 0;
public fm_login()
{
InitializeComponent();
// this.TopMost = true;
this.WindowState = FormWindowState.Maximized;
//this.FormBorderStyle = FormBorderStyle.None;
}
public void button1_Click(object sender, EventArgs e)
{
MySql.Data.MySqlClient.MySqlConnection conn;
try
{
String user_name = textBox1.Text;
String user_pass = textBox2.Text;
conn = new MySql.Data.MySqlClient.MySqlConnection();
if ((user_name != "") & (user_pass != "")&(count<3))
{
conn.ConnectionString = myConnectionString;
conn.Open();
string query = "select * from Admin_login where user_name='"+user_name+"' and Password = '"+textBox2.Text+ "'";
//string query = "select * from Admin_login where user_name='" + user_name + "' and Password == @password COLLATE SQL_Latin1_General_CP1_CS_AS '" + textBox2.Text + "'";
MySqlCommand MyCommand2 = new MySqlCommand(query, conn);
MySqlDataReader MyReader2;
MyReader2 = MyCommand2.ExecuteReader();
if (MyReader2.Read())
{
Main_Menu obj= new Main_Menu();
obj.Show();
this.Hide();
groupBox1.Hide();
GlobaVar.log_user = user_name;
}
else
{
MessageBox.Show("Kindly Enter Valid Username or password");
count ++;
}
conn.Close();
}
if (count > 3)
{
MessageBox.Show("You Excced login limit , kindly contact Administrator ");
Application.Exit();
}
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show(ex.Message);
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace BioMetrixCore
{
public partial class fm_login : Form
{
public static class GlobaVar
{
public static string log_user;
}
public string myConnectionString = "server=127.0.0.1;uid=root;" +
"pwd=zxcvbnm@12345 ; database=f_print ; SslMode=none ";
//TpAiDn2019
//zxcvbnm@12345
int count = 0;
public fm_login()
{
InitializeComponent();
// this.TopMost = true;
this.WindowState = FormWindowState.Maximized;
//this.FormBorderStyle = FormBorderStyle.None;
}
public void button1_Click(object sender, EventArgs e)
{
MySql.Data.MySqlClient.MySqlConnection conn;
try
{
String user_name = textBox1.Text;
String user_pass = textBox2.Text;
conn = new MySql.Data.MySqlClient.MySqlConnection();
if ((user_name != "") & (user_pass != "")&(count<3))
{
conn.ConnectionString = myConnectionString;
conn.Open();
string query = "select * from Admin_login where user_name='"+user_name+"' and Password = '"+textBox2.Text+ "'";
//string query = "select * from Admin_login where user_name='" + user_name + "' and Password == @password COLLATE SQL_Latin1_General_CP1_CS_AS '" + textBox2.Text + "'";
MySqlCommand MyCommand2 = new MySqlCommand(query, conn);
MySqlDataReader MyReader2;
MyReader2 = MyCommand2.ExecuteReader();
if (MyReader2.Read())
{
Main_Menu obj= new Main_Menu();
obj.Show();
this.Hide();
groupBox1.Hide();
GlobaVar.log_user = user_name;
}
else
{
MessageBox.Show("Kindly Enter Valid Username or password");
count ++;
}
conn.Close();
}
if (count > 3)
{
MessageBox.Show("You Excced login limit , kindly contact Administrator ");
Application.Exit();
}
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show(ex.Message);
}