am getting insert error, confirming my connectionstring is working properly and am working on vs2005
<appSettings> <add key="ConnectionString" value="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=|DataDirectory|\data.mdb"/> </appSettings> ===============
using System; using System.Data; using System.Data.OleDb; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;
public partial class Register : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {
protected void btnRegister_Click(object sender, EventArgs e) { { if (txtUserPwd.Text == txtReUserPwd.Text) { //call the method to execute insert to the database ExecuteInsert(txtFirstName.Text, txtLastName.Text, txtUserPwd.Text, txtReUserPwd.Text, txtEmailid.Text, txtQuestion.Text, txtAnswer.Text, txtAge.Text, ddlGender.SelectedItem.Text, txtMobileNo.Text, ddlCountry.SelectedItem.Text, txtCity.Text, ddlOccupation.SelectedItem.Text); Response.Write("Record was successfully added!"); ClearControls(Page); } else { Response.Write("Password did not match"); txtUserPwd.Focus(); }
} }
public static void ClearControls(Control Parent) { if (Parent is TextBox) { (Parent as TextBox).Text = string.Empty; } else { foreach (Control c in Parent.Controls) ClearControls(c); } } }