Here is the code :-
OleDbConnection vConn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\\information.xls;Extended Properties=Excel 12.0");
vConn.Open();
try
{
String rQLlll = "DROP TABLE NewTempTable ;";
OleDbCommand mdd = new OleDbCommand(rQLlll, vConn);
mdd.ExecuteNonQuery();
}
catch
{
}
String strSQL = "SELECT NULL as thuluuuuu,* INTO NewTempTable FROM [data$];";
OleDbCommand cmd = new OleDbCommand(strSQL, vConn);
cmd.ExecuteNonQuery();
try
{
String strSQLl = "DROP TABLE [data$];";
OleDbCommand cmdd = new OleDbCommand(strSQLl, vConn);
cmdd.ExecuteNonQuery();
String rSQLlll = "DROP TABLE data ;";
OleDbCommand mddd = new OleDbCommand(rSQLlll, vConn);
mddd.ExecuteNonQuery();
}
catch
{
}
String strSQLll = "SELECT * INTO data FROM [NewTempTable$];";
OleDbCommand cmddd = new OleDbCommand(strSQLll, vConn);
cmddd.ExecuteNonQuery();
try
{
String strSQLlll = "DROP TABLE [NewTempTable$] ;";
OleDbCommand cmdddd = new OleDbCommand(strSQLlll, vConn);
cmdddd.ExecuteNonQuery();
String rQLlll = "DROP TABLE NewTempTable ;";
OleDbCommand mdd = new OleDbCommand(rQLlll, vConn);
mdd.ExecuteNonQuery();
}
catch
{
}
MessageBox.Show("inserted");
vConn.Close();
OleDbConnection vConn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\\information.xls;Extended Properties=Excel 12.0");
vConn.Open();
try
{
String rQLlll = "DROP TABLE NewTempTable ;";
OleDbCommand mdd = new OleDbCommand(rQLlll, vConn);
mdd.ExecuteNonQuery();
}
catch
{
}
String strSQL = "SELECT NULL as thuluuuuu,* INTO NewTempTable FROM [data$];";
OleDbCommand cmd = new OleDbCommand(strSQL, vConn);
cmd.ExecuteNonQuery();
try
{
String strSQLl = "DROP TABLE [data$];";
OleDbCommand cmdd = new OleDbCommand(strSQLl, vConn);
cmdd.ExecuteNonQuery();
String rSQLlll = "DROP TABLE data ;";
OleDbCommand mddd = new OleDbCommand(rSQLlll, vConn);
mddd.ExecuteNonQuery();
}
catch
{
}
String strSQLll = "SELECT * INTO data FROM [NewTempTable$];";
OleDbCommand cmddd = new OleDbCommand(strSQLll, vConn);
cmddd.ExecuteNonQuery();
try
{
String strSQLlll = "DROP TABLE [NewTempTable$] ;";
OleDbCommand cmdddd = new OleDbCommand(strSQLlll, vConn);
cmdddd.ExecuteNonQuery();
String rQLlll = "DROP TABLE NewTempTable ;";
OleDbCommand mdd = new OleDbCommand(rQLlll, vConn);
mdd.ExecuteNonQuery();
}
catch
{
}
MessageBox.Show("inserted");
vConn.Close();
Comments
Post a Comment