inserting date using c#.Net into SQL Server 2008 using insert query
<p>I am making desktop application using C#.NET and SQL Server 2008.......in which i took one label name date and had a toolbox datetime picker.and also took field name date in database...........nw i want to insert the date throgh form using datetimepicker and get get inserted  in datatbase.......</p>

<p>using code</p>

<pre><code>SqlConnection con = new SqlConnection("Data Source=SW-PC-20;Integrated security =SSPI;Initial catalog=PSM");

con.Open();

SqlCommand cmd = new SqlCommand("insert into Campaign(Campaign_id,List_of_thresholds,Duration,Starting_Date,Ending_Date,Total_Budget_of_all_thresholds) values (" + Convert.ToInt32(cbocampaign.Text) + ",'" + cbolist_threshold.Text + "',' " + txtduration.Text + " '," + Convert.ToDateTime(DateTimePicker1.Text) + "," + Convert.ToDateTime(DateTimePicker2.Text) + "," + Convert.ToInt32(txtbudget.Text) + ")", con);

            cmd.ExecuteNonQuery();

MessageBox.Show("Insertion successfully done");
</code></pre>

<p>*<strong><em>PROBLEM :</em></strong>*it is not able to convert datetime picker error occuring .....</p>

<pre><code>Convert.ToDateTime(DateTimePicker1.Text) `
</code></pre>

<p>Please give me solution for this and also give me the coding of fetching data into textboxes  using data grid view</p>

<p>regards</p>

<p>shivani</p>
