7
Answers

csharp delete Query

Arnold Petrona

Arnold Petrona

16y
13.9k
1

I have a issue with the delete query from a combobox1 connected to a database and is as follow

 

OleDbConnection con1 = new OleDbConnection(@" Provider = Microsoft.Jet.OleDB.4.0;Data Source =C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\2Timers\2Timers\db2.mdb");

            try
            {
                string qdel = "DELETE * FROM 2Timers WHERE Name=" + comboBox1.SelectedItem.ToString();
                OleDbCommand command = new OleDbCommand(qdel, con1);

                con1.Open();
                command.ExecuteNonQuery();
                con1.Close();
                this.DialogResult = DialogResult.OK;
                this.Dispose();
            }
            catch (OleDbException ex)
            {
                MessageBox.Show("Ole error:" + ex.Message, "Ole Error");
            } 

 

the message received is no value given for one or more required paramters

 

Answers (7)