Darkc0der
20th November 2011, 09:18 AM
jadi gini gan,gw kan lg bkin program data urut kepegawaian..
errornya disini nihhh
Code:
private void btndelete_Click(object sender, EventArgs e)
{
//id = lblID.Text;
nip = textBox1.Text;
sqlQRY = "Delete * from pegawai where nip = " + nip + "";
cmd.CommandText = sqlQRY;
cmd.Connection = cn;
cmd.ExecuteNonQuery();
MessageBox.Show("Delete!", "Programmed By Cedrick", MessageBoxButtons.OK, MessageBoxIcon.Information);
clear();
fill();
}
sama yang ini
Code:
void UpdateQRY()
{
if (textBox1.Text == "")
{ }
else if (textBox2.Text == "")
{ }
else
{
//id = lblID.Text;
nip = textBox1.Text;
sqlQRY = "Update pegawai SET pegawai.nip = '" + textBox1.Text + "', pegawai.nama = '" + textBox2.Text + "', pegawai.pangkatgol = '" + textBox3.Text + "', pegawai.pangkattmt = '" + textBox4.Text + "', pegawai.jabatan = '" + textBox5.Text + "', pegawai.tmt = '" + textBox6.Text + "', pegawai.masatahun = '" + textBox7.Text + "', pegawai.masabulan = '" + textBox8.Text + "', pegawai.latjabatan = '" + textBox9.Text + "', pegawai.blnthn = '" + textBox10.Text + "', pegawai.jumlah = '" + textBox11.Text + "', pegawai.pendidikan = '" + textBox12.Text + "', pegawai.lulustahun = '" + textBox13.Text + "', pegawai.tingkatijazah = '" + textBox14.Text + "', pegawai.cat = '" + textBox15.Text + "', pegawai.ket = '" + textBox16.Text + "' WHERE pegawai.nip = " + nip + "";
cmd.CommandText = sqlQRY;
cmd.Connection = cn;
cmd.ExecuteNonQuery();
MessageBox.Show("Updated!", "Programmed By Cedrick", MessageBoxButtons.OK, MessageBoxIcon.Information);
clear();
fill();
}
}
jadi pas mo delete records ama mo update records..
nih file db nya http://www.media*fire..com/?aacoi62pl481pd6
erronya oledbexception was unhandled
data type mismatch in criteria expression..
help dah puyeng nih gan T_T
</div>
errornya disini nihhh
Code:
private void btndelete_Click(object sender, EventArgs e)
{
//id = lblID.Text;
nip = textBox1.Text;
sqlQRY = "Delete * from pegawai where nip = " + nip + "";
cmd.CommandText = sqlQRY;
cmd.Connection = cn;
cmd.ExecuteNonQuery();
MessageBox.Show("Delete!", "Programmed By Cedrick", MessageBoxButtons.OK, MessageBoxIcon.Information);
clear();
fill();
}
sama yang ini
Code:
void UpdateQRY()
{
if (textBox1.Text == "")
{ }
else if (textBox2.Text == "")
{ }
else
{
//id = lblID.Text;
nip = textBox1.Text;
sqlQRY = "Update pegawai SET pegawai.nip = '" + textBox1.Text + "', pegawai.nama = '" + textBox2.Text + "', pegawai.pangkatgol = '" + textBox3.Text + "', pegawai.pangkattmt = '" + textBox4.Text + "', pegawai.jabatan = '" + textBox5.Text + "', pegawai.tmt = '" + textBox6.Text + "', pegawai.masatahun = '" + textBox7.Text + "', pegawai.masabulan = '" + textBox8.Text + "', pegawai.latjabatan = '" + textBox9.Text + "', pegawai.blnthn = '" + textBox10.Text + "', pegawai.jumlah = '" + textBox11.Text + "', pegawai.pendidikan = '" + textBox12.Text + "', pegawai.lulustahun = '" + textBox13.Text + "', pegawai.tingkatijazah = '" + textBox14.Text + "', pegawai.cat = '" + textBox15.Text + "', pegawai.ket = '" + textBox16.Text + "' WHERE pegawai.nip = " + nip + "";
cmd.CommandText = sqlQRY;
cmd.Connection = cn;
cmd.ExecuteNonQuery();
MessageBox.Show("Updated!", "Programmed By Cedrick", MessageBoxButtons.OK, MessageBoxIcon.Information);
clear();
fill();
}
}
jadi pas mo delete records ama mo update records..
nih file db nya http://www.media*fire..com/?aacoi62pl481pd6
erronya oledbexception was unhandled
data type mismatch in criteria expression..
help dah puyeng nih gan T_T
</div>