string AppPath=Request.ServerVariables["APPL_PHYSICAL_PATH"]+"Tahsilat/";
OleDbConnection m_ConnectionToExcelBook;
OleDbDataAdapter m_AdapterForExcelBook;
m_ConnectionToExcelBook = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+AppPath+"deneme.xls;Extended Properties=Excel 8.0;");
bool ErrorExist=false;
try
{
m_ConnectionToExcelBook.Open();
DataTable dtExcelSchema = m_ConnectionToExcelBook.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
// select first sheetname
string sheetName = dtExcelSchema.Rows[0]["TABLE_NAME"].ToString();
DataTable DataObject = new DataTable();
OleDbCommand selectCommand = new OleDbCommand("select * from [" + sheetName + "]");
selectCommand.Connection = m_ConnectionToExcelBook;
m_AdapterForExcelBook = new OleDbDataAdapter();
m_AdapterForExcelBook.SelectCommand = selectCommand;
m_AdapterForExcelBook.Fill(DataObject);
if (DataObject.Rows.Count > 0)
{
.......
.......
}
How to read the first sheet in Excel with C#
Kaydol:
Kayıt Yorumları (Atom)
BlackListIP control on Serenity platform (.NET Core)
In the Serenity platform, if you want to block IPs that belong to people you do not want to come from outside in the .net core web project,...
-
In the Serenity platform, if you want to block IPs that belong to people you do not want to come from outside in the .net core web project,...
-
TABLO ADI AÇIKLAMA L_PERSONEL Çalışma Alanı Tanımları L_SYSLOG Kullanıcı Kaydı İzleme L_L...
-
Microsoft OLE DB Provider for SQL Server : Cannot create a row of size 8100 which is greater than the allowable maximum of 8060. (80040E14) ...
Hiç yorum yok:
Yorum Gönder