You are on page 1of 5

FORM1

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.OleDb;

namespace KJLAST
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button4_Click(object sender, EventArgs e)


{
Form2 form2 = new Form2();
form2.Tag = this;
form2.Show(this);
Hide();
}

private void button1_Click(object sender, EventArgs e)


{
Form3 form3 = new Form3();
form3.Tag = this;
form3.Show(this);
Hide();
}

private void button2_Click(object sender, EventArgs e)


{
Form4 form4 = new Form4();
form4.Tag = this;
form4.Show(this);
Hide();
}

private void button3_Click(object sender, EventArgs e)


{
string str = ("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:/Users/Oweng/Desktop/New folder (2)/KJLAST/REGISTER.accdb");
OleDbConnection con = new OleDbConnection(str);
OleDbCommand cmd = new OleDbCommand("SELECT COUNT(*) FROM CreateAccount where
Email = '" + textBox1.Text + "' AND pass = '" + textBox2.Text + "'", con);
con.Open();
try
{
int i;
i = Convert.ToInt32(cmd.ExecuteScalar());
if (i == 1)
{
MessageBox.Show("Success");
con.Close();
Form6 form6 = new Form6();
form6.Tag = this;
form6.Show(this);
Hide();
}//end if
else
{
MessageBox.Show("invalid username or password");
}
}//end try
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
con.Close();
}
}

private void textBox1_TextChanged(object sender, EventArgs e)


{

}
}
}

FORM2
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.OleDb;

namespace KJLAST
{
public partial class Form2 : Form
{
OleDbConnection con = new
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/Users/Oweng/Desktop/New
folder (2)/KJLAST/REGISTER.accdb");

public Form2()
{
InitializeComponent();
}

private void button2_Click(object sender, EventArgs e)


{
var form1 = (Form1)Tag;
form1.Show();
Close();
}

private void radioButton1_CheckedChanged(object sender, EventArgs e)


{

private void radioButton2_CheckedChanged(object sender, EventArgs e)


{

private void button1_Click(object sender, EventArgs e)


{
OleDbCommand cmd = con.CreateCommand();
con.Open();
cmd.CommandText = "Insert into
CreateAccount(FirstName,LastName,Email,BirthDate,Gender,Pass,RetypePass)Values('" +
textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" +
dateTimePicker1.Text + "','" + comboBox1.Text + "','" + textBox4.Text + "','" +
textBox5.Text + "')";
cmd.ExecuteNonQuery();
MessageBox.Show(" Account Created Click Back to Log in ");
con.Close();
}

private void textBox4_TextChanged(object sender, EventArgs e)


{

}
}

FORM 3
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;

namespace KJLAST
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}

private void button2_Click(object sender, EventArgs e)


{
var form1 = (Form1)Tag;
form1.Show();
Close();
}
}
}

FORM 4
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;

namespace KJLAST
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}

private void button2_Click(object sender, EventArgs e)


{
var form1 = (Form1)Tag;
form1.Show();
Close();
}
}
}

FORM 6
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 KJLAST
{
public partial class Form6 : Form
{
public Form6()
{
InitializeComponent();
}//global variables
SqlConnection sqlconnection;

SqlCommand sqlcommand;

string ConnectionString = @"Data


Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Ehtesham
Mehmood\Documents\Database1.mdf;Integrated Security=True;Connect Timeout=30";

string Query;

DataSet dataset;

DataTable datatable;

SqlDataAdapter sqladapter;

private void Form6_Load(object sender, EventArgs e)


{
// TODO: This line of code loads data into the 'songsDataSet1.tblsongs'
table. You can move, or remove it, as needed.
this.tblsongsTableAdapter.Fill(this.songsDataSet1.tblsongs);

}
}
}

You might also like