字符串未被识别为有效的DateTime

字符串未被识别为有效的DateTime

本文介绍了“字符串未被识别为有效的DateTime。”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hiii ...

Hiii...

SqlConnection con = new SqlConnection(cn.ConnectionStrings);
            GridViewRow row = (GridViewRow)grdLead.Rows[e.RowIndex];
            int userid = Convert.ToInt32(grdLead.DataKeys[e.RowIndex].Value.ToString());
            Label lblLedId = (Label)grdLead.FindControl("lblLedId");
            TextBox txtleadid = (TextBox)row.Cells[0].Controls[0];
            TextBox txtfirstname = (TextBox)row.Cells[1].Controls[0];
            TextBox txtdate = (TextBox)row.Cells[5].Controls[0];
            TextBox txtstatus = (TextBox)row.Cells[6].Controls[0];
            TextBox txtrevenue=(TextBox)row.Cells[3].Controls[0];
            TextBox txtproduct=(TextBox)row.Cells[4].Controls[0];
            TextBox txtowner = (TextBox)row.Cells[7].Controls[0];
            TextBox txtcompany = (TextBox)row.Cells[2].Controls[0];
            GridView1.EditIndex = -1;
            con.Open();
            string QUERY=" UPDATE [WebCrm].[dbo].[tbl_Lead] SET FirstName='" + txtfirstname.Text + "', Date='" +Convert.ToDateTime(txtdate.Text) + "', Status='" + txtstatus.Text + "',PotentialRevenue='" + txtrevenue.Text + "',ProductInterest='" + txtproduct.Text + "', Owner='" + txtowner.Text + "',Company='" + txtcompany.Text + "' where LedId=" + userid + "";
            SqlCommand cmd = new SqlCommand(QUERY, con);
            cmd.ExecuteNonQuery();
            con.Close();

推荐答案


这篇关于“字符串未被识别为有效的DateTime。”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-20 23:05