I'm very new in C#. I've written a small code. Can you help me with it : Here is my code :
private void button1_Click(object sender, EventArgs e)
{
string povezava = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\Matic\\Documents\\FERI\\2.LETNIK\\1.SEMESTER\\RPS\\VAJA3\\bazaPodatkov.accdb";
string zapisi = "update Zaposleni set ID='" + this.textBox1.Text +
"',Ime='" + this.textBox2.Text +
"',Priimek='" + this.textBox3.Text +
"',Uporabnisko_ime='" + this.textBox4.Text +
"',Geslo='" + this.textBox5.Text +
"',E_posta='" + this.textBox6.Text +
"',Ulica='" + this.textBox7.Text +
"',Hisna_stevilka='" + this.textBox8.Text +
"',Mesto='" + this.textBox9.Text +
"',Delovno_mesto='" + this.textBox10.Text +
"' where ID='" + this.textBox1.Text + "';";
OleDbConnection baza = new OleDbConnection(povezava);
OleDbCommand beri = new OleDbCommand(zapisi, baza);
OleDbDataReader branje;
try
{
baza.Open();
branje = beri.ExecuteReader();
MessageBox.Show("Podatki so shranjeni.");
while (branje.Read())
{
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
I'm having a datatype mismatch in criteria expression.
Do you see anything wrong in my code ?