i am having a run time error...
on my enquiry form..please help me out...
asp.net with c#, sql server
i need your help..please
eroor message is:
Error Occured! Try AgainSystem.ArgumentException: No mapping exists from object type System.Web.UI.WebControls.TextBox to a known managed provider native type. at System.Data.SqlClient.MetaType.GetMetaTypeFromValue(Type dataType, Object value, Boolean inferLen, Boolean streamAllowed) at System.Data.SqlClient.SqlParameter.GetMetaTypeOnly() at System.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc) at System.Data.SqlClient.SqlCommand.BuildParamList(TdsParser parser, SqlParameterCollection parameters) at System.Data.SqlClient.SqlCommand.BuildExecuteSql(CommandBehavior behavior, String commandText, SqlParameterCollection parameters, _SqlRPC& rpc) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Corporate2.Button1_Click(Object sender, EventArgs e)Thanks for Applying, We will response on your application shortly
my .cs page code:
protected void Button1_Click(object sender, EventArgs e)
{
try
{
string str = "Data Source=HP-PC\\SQLEXPRESS;Initial Catalog=Earth;Integrated Security=True";
SqlConnection con = new SqlConnection(str);
con.Open();
string insertQuery = "insert into Current (Name,Emailaddress,Contactno,Qualification,Institute) values (@Name,@Emailaddress,@Contactno,@Qualification,@Institute)";
SqlCommand com = new SqlCommand(insertQuery, con);
com.Parameters.AddWithValue("@Name", txtName.Text);
com.Parameters.AddWithValue("@Emailaddress", txtEmailaddress.Text);
com.Parameters.AddWithValue("@Contactno", txtContactno.Text);
com.Parameters.AddWithValue("@Qualification", txtQualification.Text);
com.Parameters.AddWithValue("@Institute", txtInstitute);
com.ExecuteNonQuery();
con.Close();
}