I guess you get a runtime error .
Am I right?
First of all, this is a terrible mix of string concatenations.
Very difficult to read, hence difficult to trouble shoot.
string cmd = string.Format("Update mobilesubscriberdata1 set " + fieldname + "='" + val + "' where m_date='{0}''{1}'", dateTimePicker1.Value.ToString("yyyy-MM-dd") + " and id=" + Id + "");
obj.GetDataTable(cmd);
Change the code to this
string cmd = string.Format(@"
UPDATE mobilesubscriberdata1 SET fieldname = '{0}'
WHERE m_date = '{1}''{2}' AND id = '{3}'",
val, dateTimePicker1.Value.ToString("yyyy-MM-dd"), id);
obj.GetDataTable(cmd);
(Not sure if
fieldname
is a variable or column name. I assumed a column name)
If you take a look now you might see something suspicious.
Hint: Count the arguments. (Why two for the date but only 1 argument?)