hello everyone. I am doing a program with c# DatabaseMicrosoftAcces
And I got error Overflow. It points out in ExecuteQuery();
pls help me.
Here's my code
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 sad
{
public partial class SignIn : Form
{
private OleDbConnection personalConn;
private OleDbCommand oleDbCmd = new OleDbCommand();
private String connParam = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\EtaYuy\Documents\Databases.mdb;Persist Security Info=False";
public SignIn()
{
personalConn = new OleDbConnection(connParam);
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Close();
T frm = new T();
frm.Show();
}
private void button2_Click(object sender, EventArgs e)
{
personalConn.Open();
oleDbCmd.Connection = personalConn;
oleDbCmd.CommandText = "insert into Personaldata(Bloclno,Lotno,Numberofoccupants,Firstname,Familyname,Dateofbirth,Age,Bloodtype,Placeofbirth,Religion) values ('" + this.textBox1.Text + "','" + this.textBox2.Text + "','" + this.textBox3.Text + "','" + this.textBox4.Text + "','" + this.textBox5.Text + "','" + this.textBox6.Text + "','" + this.textBox7.Text + "','" + this.textBox8.Text + "','" + this.textBox9.Text + "','" + this.textBox10.Text + "');";
oleDbCmd.CommandText = "insert into Spouse(Firstname,Familyname,Dateofbirth,Age,Bloodtype,Placeofbirth,Religion,Startofoccupancy,Contactnumber,NumberofChildren,Numberofdogs,Vaccinatedwithantirabies) values ('" + this.textBox11.Text + "','" + this.textBox12.Text + "','" + this.textBox21.Text + "','" + this.textBox13.Text + "','" + this.textBox14.Text + "','" + this.textBox15.Text + "','" + this.textBox16.Text + "','" + this.textBox17.Text + "','" + this.textBox18.Text + "','" + this.textBox22.Text + "','" + this.textBox25.Text + "','" + this.textBox19.Text + "');";
int temp = oleDbCmd.ExecuteNonQuery();// error here
if (temp > 0)
{
textBox1.Text = null;
textBox2.Text = null;
textBox3.Text = null;
textBox4.Text = null;
textBox5.Text = null;
textBox6.Text = null;
textBox7.Text = null;
textBox8.Text = null;
textBox9.Text = null;
textBox10.Text = null;
textBox11.Text = null;
textBox12.Text = null;
textBox21.Text = null;
textBox13.Text = null;
textBox14.Text = null;
textBox15.Text = null;
textBox16.Text = null;
textBox17.Text = null;
textBox18.Text = null;
textBox22.Text = null;
textBox25.Text = null;
textBox19.Text = null;
MessageBox.Show("Record Successfuly Added");
}
else
{
MessageBox.Show("Record Fail to Added");
}
personalConn.Close();
}
private void SignIn_Load(object sender, EventArgs e)
{
}
}
}
Thank you