سلام دوست عزیز من با انجام این دستورات نتونستم به مقصودم برسم اصلا passرو چک نمی کنه ممنون میشم اگه بتونید کمک کنید
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication4
{
publicpartialclassForm1 : Form
{
public Form1()
{
InitializeComponent();
}
privatevoid button1_Click(object sender, EventArgs e)
{
SqlConnection myConnection = newSqlConnection();
myConnection.ConnectionString = "Data Source=localhost;Initial Catalog=tamrin;Integrated Security=True";
try
{
myConnection.Open();
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
}
SqlCommand cmd = newSqlCommand("SELECT username,passwrod FROM users WHERE username='" + textBox1.Text + "'And passwrod='" + textBox2.Text + "'", myConnection);
SqlDataReader dr = cmd.ExecuteReader();
string userText = textBox1.Text;
string passText = textBox2.Text;
while (dr.Read())
{
if (dr["username"].ToString() == userText && dr["passwrod"].ToString() == passText)
MessageBox.Show("Successful Log In");
else
MessageBox.Show("Username and Password do not match");
}
dr.Close();
myConnection.Close();
}
}
}
Bookmarks