I have a spreadsheet that need to accept data from a asp.net app.
I have wrote some c# that allows me to read data from another spread sheet but now i want to input some data from text boxes.
protected void Button2_Click(object sender, EventArgs e)
{
OleDbConnection conn = new OleDbConnection();
string path = Server.MapPath("LOG_TEST.xlsx");
String connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties='Excel 12.0;IMEX=1;'";
conn.ConnectionString = connString;
conn.Open();
OleDbCommand cmd = new OleDbCommand("INSERT INTO [Sheet1$] ([NAME], [MOBILE], [EMAIL]) VALUES('" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "')",conn);
OleDbDataReader rd = cmd.ExecuteReader();
conn.Close();
}
Just imple insert 3 values into the spread sheet.
error im getting is below.
I believe the issue is around
OleDbDataReader rd = cmd.ExecuteReader();
but not sure what to replace it with.
