Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 System.Data.SqlClient;
- namespace OODB
- {
- public partial class Register : Form
- {
- public Register()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\boby\Desktop\OODB\OODB\Database1.mdf;Integrated Security=True");
- SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) From dbo where Username='" + textBox1.Text + "' and Password= '" + textBox2.Text + "'" + con);
- DataTable dt = new DataTable();
- sda.Fill(dt);
- if (dt.Rows[0][0].ToString() == "1")
- {
- Form f = new P1();
- f.Show();
- Hide();
- }
- else
- {
- MessageBox.Show("Sorry");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement