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.OleDb;
namespace OhFlowerz
{
public partial class AddCust : Form
{
//creates a new connection to your DB
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=""C:\Users\Shaikh\Documents\OhFlowers - Copy.accdb""");
public AddCust()
{
InitializeComponent();
}
private void btnAddCust_Click(object sender, EventArgs e)
{
//open the connection to your DB
try
{
conn.Open();
//SQL Command
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "incert into OhFlowers - Copy(FirstName,LastName,UserName,Email,PromotionalMaterial,BusinessType)values('" + textBox1.Text + "', '" + textBox4.Text + "', '" + textBox3.Text + "','" + textBox2.Text + "', '" + textBox3.Text + "','" + txtPromo.Text + "', '" + txtBusType.Text + "')";
cmd.ExecuteNonQuery();
MessageBox.Show("New Customer Added", "Access Connect", MessageBoxButtons.OK, MessageBoxIcon.Information);
conn.Close();
new Home().Show();
this.Close();
}
//Failed to connect to tour DB
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Access Connect", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}