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;
- using System.Data;
- namespace LoginAndGestao
- {
- public partial class Form1 : Form
- {
- SqlConnection conn = new SqlConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:-Users-André-Documents-login.mdb");
- SqlCommand comando = new SqlCommand();
- SqlDataReader dr;
- public Form1()
- {
- InitializeComponent();
- }
- private void panel1_Paint(object sender, PaintEventArgs e)
- {
- comando.Connection = conn;
- }
- private void button2_Click(object sender, EventArgs e)
- {
- if (MessageBox.Show("Deseja Sair?", "Sair", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- {
- Application.Exit();
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- if (textBox1.Text != "" & textBox2.Text != "")
- {
- conn.Open();
- comando.CommandText = "INSERT INTO Login(Usuario, Senha) VALUES('" + textBox1.Text + "', '" + textBox2.Text + "')";
- comando.ExecuteNonQuery();
- conn.Close();
- textBox1.Text = "";
- textBox2.Text = "";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement