C#从对象类型System.Web.UI.WebControls.TextBox到已知的托管提供程序本机类型没有映射

时间:2017-10-13 23:49:41

标签: c#

请帮助!我在浏览器中查看后出错! :

从对象类型System.Web.UI.WebControls.TextBox到已知的托管提供程序本机类型不存在映射。

---无法执行 -

=========================================

SqlConnection conn = new SqlConnection();
SqlCommand cmd = new SqlCommand();

conn.ConnectionString = ConfigurationManager.ConnectionStrings[1].ToString();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "ManageMember";

cmd.Parameters.AddWithValue("@check", "a");
cmd.Parameters.AddWithValue("@username", UserNameTxt.Text);
cmd.Parameters.AddWithValue("@password", PasswordTxt.Text);
cmd.Parameters.AddWithValue("@name", FullNameTxt.Text);
cmd.Parameters.AddWithValue("@email", EmailTxt.Text);
cmd.Parameters.AddWithValue("@phone", PhoneTxt.Text);
cmd.Parameters.AddWithValue("@company", CompanyTxt);
cmd.Parameters.AddWithValue("@gender", RdList.SelectedValue);
cmd.Parameters.AddWithValue("@BirthDate", BirthdateTxt.Text);
cmd.Parameters.AddWithValue("@question", Quastxt.Text);
cmd.Parameters.AddWithValue("@answer", AnswTxt.Text);

conn.Open();
cmd.ExecuteNonQuery();
lblMsg.Text = "User Added Successfully";
conn.Close();

1 个答案:

答案 0 :(得分:1)

更改

<script >

cmd.Parameters.AddWithValue("@company", CompanyTxt);

然后在前额拍打自己。