Click here to Skip to main content
16,012,025 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
// error is "No value given for one or more required parameters."



C#
try
             {
                   string query = "update Birth_Detail_Info set [जन्म नोंदणी]='" + txtNonadniNo.Text + "',[नोंदणी दिनांक]='" + date + "',[जन्म दिनांक]='" + date1 + "',[महसूल क्षेत्र]='" + cmbMahasul.Text + "',[बाळाचे नाव]='" + txtbalacheName.Text + "',लिंग='" + cmbLinga.Text + "',[वडिलांच नाव]='" + txtFatherName.Text + "',[आईचे नाव]='" + txtMotherName.Text + "',[कायमचा पत्ता]='" + txtPamantAdd.Text + "',[जन्म प्रकार]='" + cmbBirthType.Text + "',[जन्म ठिकाण]='" + txtJPlace.Text + "',[वर्दी देणाऱ्याचे नाव]='" + txtInfoName.Text + "',नोंद='" + txtNonda.Text + "',[वर्दी देणाऱ्याचा पत्ता]='" + txtInfoAdd.Text + "',[उपजत मृत्यू]='" + cmbUpjat.Text + "' where [अ क्रं] =" + id.ToString();

                  cmd = new OleDbCommand(query, con);
                  con.Open();
                  cmd.ExecuteNonQuery();
                  DialogResult result = MsgBox.Show("माहिती साठवली आहे", "सुचना", MsgBox.Buttons.OK, MsgBox.Icon.Info, MsgBox.AnimateStyle.FadeIn);
              }
              catch (Exception ex)
              {

                  MessageBox.Show(ex.Message);
              }
              finally
              {
                  con.Close();
              }
Posted
Updated 24-Feb-15 18:26pm
v2
Comments
Suvendu Shekhar Giri 25-Feb-15 0:38am    
Check the signature of MsgBox.Show(). Make sure that it has definition with the parameter type and count as you are passing.

1 solution

The problem may be in the data since you concatenate values directly into the SQL statement. Do not do that. Instead use OleDbParameter[^] for your values.

That will keep you safe from SQL injections, problems with parenthesis, data type conversions etc.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900