title: How to insert data in excel using asp.net?
body: <p>I am trying to insert a record in Excel using asp.net but it is giving error like this..</p>
  
  <blockquote>
    <p>ERROR [IM002] [Microsoft][ODBC Driver
    Manager] Data source name not found
    and no default driver specified</p>
  </blockquote>
  
  <p>My code is as follows:</p>
  
  <pre><code>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");
  }
  </code></pre>