private void btnCreateWGN_Click(object sender, EventArgs e)
{
OleDbConnection oledbConn = new OleDbConnection();
try
{
oledbConn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
Application.StartupPath + @"\ExcelData\grided_wgn.xlsx; Extended Properties='Excel 12.0;HDR=YES;IMEX=1;';");
oledbConn.Open();
OleDbCommand cmd = new OleDbCommand(); ;
DataSet ds = new DataSet(); ;
cmd.Connection = oledbConn;
OleDbDataAdapter adap = new OleDbDataAdapter("SELECT * FROM [IMD_1deg_wgn$]", oledbConn);
adap.Fill(ds, "dsSlno");
DataTable dt = ds.Tables["dsSlno"];
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
{
OleDbConnection oledbConn = new OleDbConnection();
try
{
oledbConn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
Application.StartupPath + @"\ExcelData\grided_wgn.xlsx; Extended Properties='Excel 12.0;HDR=YES;IMEX=1;';");
oledbConn.Open();
OleDbCommand cmd = new OleDbCommand(); ;
DataSet ds = new DataSet(); ;
cmd.Connection = oledbConn;
OleDbDataAdapter adap = new OleDbDataAdapter("SELECT * FROM [IMD_1deg_wgn$]", oledbConn);
adap.Fill(ds, "dsSlno");
DataTable dt = ds.Tables["dsSlno"];
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
No comments:
Post a Comment