Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
6
Reply
INSERT INTO doesn't insert data in the database
Nel
Sep 12 2013 4:45 AM
1.6k
Reply
Hi,
I have this code for inserting data in the MS ACCESS database:
command.CommandText = "Insert into PSOSTD ([SMAT11], [SKOM], [KOL], [CEN], [BRP], [DOK],[DATA], [SERBR1], [SERBR2], [MBRK], [IN]) values (?,?,?,?,?,?,?,?,?,?,?)";
command.Parameters.AddWithValue("@SMAT11", comboBox1.Text);
command.Parameters.AddWithValue("@SKOM", comboBox3.Text);
command.Parameters.AddWithValue("@KOL", Convert.ToInt32(textBox4.Text));
command.Parameters.AddWithValue("@CEN", Convert.ToInt32(label15.Text));
command.Parameters.AddWithValue("@BRP", textBox1.Text);
command.Parameters.AddWithValue("@DOK", "4");
command.Parameters.AddWithValue("@DATA", dateTimePicker1.Value.Date);
command.Parameters.AddWithValue("@SERBR1", "");
command.Parameters.AddWithValue("@SERBR2", "");
command.Parameters.AddWithValue("@MBRK", comboBox2.SelectedItem);
if (radioButton1.Checked)
{
command.Parameters.AddWithValue("@IN", "J");
}
else if (radioButton2.Checked)
{
command.Parameters.AddWithValue("@IN", "A");
}
else
{
MessageBox.Show("Nemate izbrano dali kontrolorot e od JSP ili od agencija");
comboBox2.Focus();
}
DataSet1 dset = new DataSet1();
conn.Open();
command.ExecuteNonQuery();
conn.Close();
When debugging, I don't get any error, but it doesn't insert data in the database.
Can anybody help me please?
Thanks
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
6
)
Next Recommended Forum
Culture Problem in C# Application
save multiple