Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views2 pages

String User

The document outlines a login process using a SQL database, where user credentials are validated against stored records. If the login is successful, a message is displayed; otherwise, an error message is shown. Additionally, it includes a payment form for processing transactions with relevant details such as payment ID, booking ID, amount, and payment date.

Uploaded by

sa8349964
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

String User

The document outlines a login process using a SQL database, where user credentials are validated against stored records. If the login is successful, a message is displayed; otherwise, an error message is shown. Additionally, it includes a payment form for processing transactions with relevant details such as payment ID, booking ID, amount, and payment date.

Uploaded by

sa8349964
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

string user_name = textBox1.Text.

Trim();

string passward = textBox2.Text.Trim();

string user_type = comboBox1.Text.Trim();

bool success = loginDAL.LOGIN();

if (success == true)

MessageBox.Show("login successful");

else

MessageBox.Show("Invalid user_type");

SqlConnection conn = new SqlConnection("desktop-av1oimq\\sqlexpress.sj travel agency.dbo");

conn.Open();

string sql = "SELECT COUNT(*) FROM login WHERE


user_name=@user_name,passward=@passward,user_type=@user_type";

SqlCommand cmd = new SqlCommand(sql, conn);

cmd.Parameters.AddWithValue("@user_name"= textBox1.Text);

cmd.Parameters.AddWithValue("@passward "= textBox2.Text);

cmd.Parameters.AddWithValue("@user_type"= comboBox1.Text);

int count =(int)cmd.ExecuteScalar();

conn.Close();

if(count > 0)

{
MessageBox.Show("loggin suuccessfully!","info", MessageBoxButtons.OK,
MessageBoxIcon.Information);

else

MessageBox.Show("error in login");

PAYMENT FORM

var payment = new Payment


{
payment_id = int.Parse(textBox1.Text),
booking_id = textBox2.Text,
amount = decimal.Parse(textBox2.Text),
payment_date = DateTime.Parse(dateTimePicker1.Text)
};
payments.Add(payment);
RefreshGrid();

You might also like