incorect syntax near '1'. there is only 1 in date time picker
SqlCommand cmdd = new SqlCommand("INSERT INTO investor_detail (investor_id,investor_cnic,investor_amount,date,pay_amount,remaining_amount ) VALUES ('" + a + "','" + b + "','" + investoramount.Text + "','" + dateTimePicker1.Value + "','" + payamount.Text + "','" + remainnigamount.Text + "'", my);
cmdd.ExecuteNonQuery();
Loading
Satyapriya NayakPosted Dec 15, 2013, 3:41 AM
str = "Insert into investor_detail(investor_id,investor_cnic,investor_amount,[date],pay_amount,remaining_amount) Values (@investor_id,@investor_cnic,@investor_amount,@date,@pay_amount,@remaining_amount)";
com = new OleDbCommand(str, con);
com.Parameters.AddWithValue("@investor_id", textBox1.Text);
com.Parameters.AddWithValue("@investor_cnic", textBox2.Text);
com.Parameters.AddWithValue("@investor_amount", textBox3.Text);
com.Parameters.AddWithValue("@date", dateTimePicker1.Value);
com.Parameters.AddWithValue("@pay_amount", textBox4.Text);
com.Parameters.AddWithValue("@remaining_amount", textBox5.Text);
com.ExecuteNonQuery();
con.Close();