|
|
|
C# ช่วยดู error ตัวนี้ให้หน่อยฮะ the microsoft.ace.oledb.12.0 provider is not registered on the local machine |
|
|
|
|
|
|
|
ช่วยดูำerror ตรงนี้ให้หน่อยครับ the microsoft.ace.oledb.12.0 provider is not registered on the local machine
Code (C#)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Atomservice12
{
public partial class addcustomer : Form
{
public addcustomer()
{
InitializeComponent();
}
OleDbConnection connect = new OleDbConnection();
private void Button1_Click(object sender, EventArgs e)
{
connect.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Walk\Desktop\18-11-57 project\Atomservice12\Atomservice12\Database1.accdb";
string CUs_No = textbox1.Text;
string Cus_Name = textbox2.Text;
string Cus_SName = textbox3.Text;
string Cus_Form = textbox4.Text;
string Cus_Phone = textbox5.Text;
string Cus_Email = textbox7.Text;
connect.Open();
OleDbCommand cmd = new OleDbCommand("INSERT into Cusupdate(CUs_No,Cus_Name,Cus_SName,Cus_Form,Cus_Phone,Cus_Email)" + "values(@CUs_No,@Cus_Name,@Cus_SName,@Cus_Form,@Cus_Phone,@Cus_Email)", connect);
if (connect.State == ConnectionState.Open)
{
cmd.Parameters.Add("@CUs_No", OleDbType.Char, 20).Value = CUs_No;
cmd.Parameters.Add("@Cus_Name", OleDbType.Char, 20).Value = Cus_Name;
cmd.Parameters.Add("@Cus_SName", OleDbType.Char, 20).Value = Cus_SName;
cmd.Parameters.Add("@Cus_Form", OleDbType.Char, 20).Value = Cus_Form;
cmd.Parameters.Add("@Cus_Phone", OleDbType.Char, 20).Value = Cus_Phone;
cmd.Parameters.Add("@Cus_Email", OleDbType.Char, 20).Value = Cus_Email;
try
{
cmd.ExecuteNonQuery();
MessageBox.Show("เพิ่มข้อมูลเเล้ว");
textbox1.Text = "";
textbox2.Text = "";
textbox3.Text = "";
textbox4.Text = "";
textbox5.Text = "";
textbox7.Text = "";
}
catch(Exception expe)
{
MessageBox.Show(expe.Source);
connect.Close();
}
}
else
{
MessageBox.Show("Connection Failed");
}
}
private void addcustomer_Load(object sender, EventArgs e)
{
//TODO: This line of code loads data into the 'database1DataSet.tb_CUS' table. You can move, or remove it, as needed.
this.tb_CUSTableAdapter.Fill(this.database1DataSet.tb_CUS);
}
private void Button3_Click(object sender, EventArgs e)
{
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void Cus_Name_TextChanged(object sender, EventArgs e)
{
}
private void Cus_Email_TextChanged(object sender, EventArgs e)
{
}
}
}
Tag : C#
|
|
|
|
|
|
Date :
2014-11-26 19:48:17 |
By :
toko2041 |
View :
1899 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|