EDN Admin
Well-known member
Hello Friends,
I have a problem and I havent solved it. Please help me. I have a access database . And I want to update to table " Personel".
I am selecting name,surname ( these ID ="TC" also selected backround ) . After that ,when added number from textbox1 and press the button . After table will update. But ı have an error.
TC : long integer
izinKullan : decimal datatype access db.
OleDbDataAdapter da;
DataSet ds;
public OleDbConnection con;
public Sorgu(Form1 ff)
{
// TODO: Complete member initialization
InitializeComponent();
frm1 = ff;
}
private void Sorgu_Load(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection();
con.ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Mesai.mdb";
con.Open();
OleDbCommand cmd_select = new OleDbCommand("select Ad+ +Soyad as ADSOYAD,NetMesai,izinHakki,izinKullan,TC from Personel order by Ad", con);
da = new OleDbDataAdapter();
da.SelectCommand = cmd_select;
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
ds = new DataSet();
da.Fill(ds, "Personel");
comboBox1.DataSource = ds.Tables["Personel"];
comboBox1.DisplayMember = "ADSOYAD";
comboBox1.ValueMember = "TC";
con.Close();
}
private void Sorgu_FormClosed(object sender, FormClosedEventArgs e)
{
frm1.Show(this);
}
private void button2_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection();
con.ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Mesai.mdb";
OleDbCommand cmd_update = new OleDbCommand();
con.Open();
cmd_update.Connection = con;
cmd_update.CommandText = "UPDATE Personel SET izinKullan=" + Convert.ToDecimal(textBox1.Text) + " Where TC=" + Convert.ToUInt64(comboBox1.SelectedValue) + " ";
cmd_update.ExecuteNonQuery(); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! problem error here..
con.Close();
View the full article
I have a problem and I havent solved it. Please help me. I have a access database . And I want to update to table " Personel".
I am selecting name,surname ( these ID ="TC" also selected backround ) . After that ,when added number from textbox1 and press the button . After table will update. But ı have an error.
TC : long integer
izinKullan : decimal datatype access db.
OleDbDataAdapter da;
DataSet ds;
public OleDbConnection con;
public Sorgu(Form1 ff)
{
// TODO: Complete member initialization
InitializeComponent();
frm1 = ff;
}
private void Sorgu_Load(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection();
con.ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Mesai.mdb";
con.Open();
OleDbCommand cmd_select = new OleDbCommand("select Ad+ +Soyad as ADSOYAD,NetMesai,izinHakki,izinKullan,TC from Personel order by Ad", con);
da = new OleDbDataAdapter();
da.SelectCommand = cmd_select;
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
ds = new DataSet();
da.Fill(ds, "Personel");
comboBox1.DataSource = ds.Tables["Personel"];
comboBox1.DisplayMember = "ADSOYAD";
comboBox1.ValueMember = "TC";
con.Close();
}
private void Sorgu_FormClosed(object sender, FormClosedEventArgs e)
{
frm1.Show(this);
}
private void button2_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection();
con.ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Mesai.mdb";
OleDbCommand cmd_update = new OleDbCommand();
con.Open();
cmd_update.Connection = con;
cmd_update.CommandText = "UPDATE Personel SET izinKullan=" + Convert.ToDecimal(textBox1.Text) + " Where TC=" + Convert.ToUInt64(comboBox1.SelectedValue) + " ";
cmd_update.ExecuteNonQuery(); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! problem error here..
con.Close();
View the full article