hi im trying to write to a sql database from textboxes using C#, however i keep getting the following error
'System.Data.DataRow.DataRow(System.Data.DataRowBuilder)' is inaccessible due to its protection level.
the code i am using is
public partial class Register : System.Web.UI.Page
{
SqlConnection objConnection;
SqlDataAdapter objMemberDA;
SqlCommandBuilder objMemberCB;
DataSet objDataSet = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
objConnection = new SqlConnection("Data Source=....;Initial Catalog=....;Integrated Security=True;");
objMemberDA = new SqlDataAdapter("Select * from tblMember", objConnection);
objMemberCB = new SqlCommandBuilder(objMemberDA);
}
public void Retrieve()
{
objDataSet.Clear();
objMemberDA.FillSchema(objDataSet,SchemaType.Source, "tblMember");
objMemberDA.Fill(objDataSet, "tblMember");
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
DataRow objRow = new DataRow();
objRow = objDataSet.Tables["tblMember"].NewRow();
objRow["Name"] = txtMemberName.Text;
objRow["Password"] = txtPassword.Text;
objRow["ConfirmPassword"] = txtConPassword.Text;
objRow["Address1"] = txtAddress1.Text;
objRow["Address2"] = txtAddress2.Text;
objRow["Address3"] = txtAddress3.Text;
objRow["Telephone"] = txtTelephone.Text;
objRow["Mobile"] = txtMobile.Text;
objDataSet.Tables["tblMember"].Rows.Add(objRow);
objMemberDA.Update(objDataSet, "tblMember");
Retrieve();
Any help would be great
Thank You
'System.Data.DataRow.DataRow(System.Data.DataRowBuilder)' is inaccessible due to its protection level.
the code i am using is
public partial class Register : System.Web.UI.Page
{
SqlConnection objConnection;
SqlDataAdapter objMemberDA;
SqlCommandBuilder objMemberCB;
DataSet objDataSet = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
objConnection = new SqlConnection("Data Source=....;Initial Catalog=....;Integrated Security=True;");
objMemberDA = new SqlDataAdapter("Select * from tblMember", objConnection);
objMemberCB = new SqlCommandBuilder(objMemberDA);
}
public void Retrieve()
{
objDataSet.Clear();
objMemberDA.FillSchema(objDataSet,SchemaType.Source, "tblMember");
objMemberDA.Fill(objDataSet, "tblMember");
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
DataRow objRow = new DataRow();
objRow = objDataSet.Tables["tblMember"].NewRow();
objRow["Name"] = txtMemberName.Text;
objRow["Password"] = txtPassword.Text;
objRow["ConfirmPassword"] = txtConPassword.Text;
objRow["Address1"] = txtAddress1.Text;
objRow["Address2"] = txtAddress2.Text;
objRow["Address3"] = txtAddress3.Text;
objRow["Telephone"] = txtTelephone.Text;
objRow["Mobile"] = txtMobile.Text;
objDataSet.Tables["tblMember"].Rows.Add(objRow);
objMemberDA.Update(objDataSet, "tblMember");
Retrieve();
Any help would be great
Thank You