binding sql dataset using
Revision 1
sir!
I have written the code for the insert query for the sql dataset.
and i want to show the same data in datagridview. pls consider this code:
private void btnSave_Click(object sender, EventArgs e)
{
string s = dtpdue_date.Value.ToString();
string s1 = dtpcompletiondate.Value.ToString();
string connectionstr = "Data Source=TUSHAR-PC;Initial Catalog=callcenter;Persist Security Info=True;User ID=sa;Password=password@123";
string sql = "Insert into tasks(t_id,Name,Priority,status,Due_date,description,date of completion)"+txtT_id.Text+",'"+txtname.Text+"','"+cbopriority.Text+",'"+cboStatus.Text+"','"+ s+"','"+txtcomments.Text+"'.'"+s1+"')";
da = new SqlDataAdapter(sql,connectionstr);
ds = new DataSet();
connectionstr.Close();
txtT_id.Text = " ";
txtname.Text = " ";
cbopriority.Text = " ";
cboStatus.Text = " ";
txtcomments.Text = " ";
dtpdue_date.Text = " ";
dtpcompletiondate.Text = "";
}
}
Posted 14-Jan-13 5:13am
by
tusharkaushik.