I am trying to insert a record in Excel using asp.net but it is giving error like this..
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
My code is as follows:
string connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\student.xls;Extended Properties=Excel 8.0;HDR=YES;";
con = new OdbcConnection(connect);
string query = "insert into [Sheet1$](sid,sname,saddress) values('6','ravi','rajam')";
OdbcCommand objCmd = new OdbcCommand(query,con);
int i= objCmd.ExecuteNonQuery();
if (i == 1)
{
Response.Write("inserted");
}
else
{
Response.Write("Not inserted");
}