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.Data.OleDb;
- using System.Data.SqlClient;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Insert_Test
- {
- public partial class Form1 : Form
- {
- private OleDbConnection connection = new OleDbConnection();
- string database = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\password.accdb";
- public Form1()
- {
- InitializeComponent();
- connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + database + ";Jet OLEDB:Database Password=1711223ms;";
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- MessageBox.Show("Please input your password here", "Password Request Instrucion", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- private void pass_btn_Click(object sender, EventArgs e)
- {
- try
- {
- connection.Open();
- OleDbCommand command = new OleDbCommand();
- command.Connection = connection;
- command.CommandText = "INSERT INTO Password ([password]) VALUES('" + password.Text + "')";
- command.ExecuteNonQuery();
- MessageBox.Show("Success");
- connection.Close();
- }
- catch (Exception ex)
- {
- MessageBox.Show(Convert.ToString(ex));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement