This is the error
Server Error in '/Kibritak3' Application.
Invalid column name 'Name'. Invalid column name 'Phone'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'Name'. Invalid column name 'Phone'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
its just come if i write this code
**
if (Literal1.Text == "Data inserted successfully")
{
Response.Redirect("http://localhost:1038/Kibritak3/CompanyHomePage.aspx");
}
else {
txtName.Text = "";
txtEmail.Text = "";
txtPhone.Text = "";
}
**
and without it evrything is ok
-------------------------
full code:
public void refress()
{
txtName.Text = "";
txtEmail.Text = "";
txtPhone.Text = "";
txtLocation.Text = "";
txtHistory.Text = "";
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
SqlCommand cmd = new SqlCommand("insert into Com_INFO(Name,Email,Phone,Location,History) values('" + txtName.Text + "','" + txtEmail.Text + "','" +txtPhone.Text+ "','" +txtLocation.Text+ "','"+txtHistory.Text+"')", con);
cmd.CommandType = CommandType.Text;
try
{
con.Open();
cmd.ExecuteNonQuery();
Literal1.Text = "Data inserted successfully";
con.Close();
refress();
}
catch (Exception ex)
{
Literal1.Text = ex.Message;
}
if (Literal1.Text == "Data inserted successfully")
{
Response.Redirect("http://localhost:1038/Kibritak3/CompanyHomePage.aspx");
}
else {
txtName.Text = "";
txtEmail.Text = "";
txtPhone.Text = "";
}
}
}