<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Asp.Net Xls Read | SanalData | Yazılım ve Teknoloji Haberleri Sitesi</title>
	<atom:link href="https://www.sanaldata.com/e/asp-net-xls-read/feed" rel="self" type="application/rss+xml" />
	<link>https://www.sanaldata.com</link>
	<description>Yazılım ve teknoloji üzerine her türlü makaleye ulaşabileceğiniz site</description>
	<lastBuildDate>Fri, 19 Aug 2022 15:26:17 +0000</lastBuildDate>
	<language>tr</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.sanaldata.com/wp-content/uploads/2016/11/cropped-logo-32x32.png</url>
	<title>Asp.Net Xls Read | SanalData | Yazılım ve Teknoloji Haberleri Sitesi</title>
	<link>https://www.sanaldata.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Asp.net ile Excel Okuma ve Repeater Yükleme</title>
		<link>https://www.sanaldata.com/asp-net-ile-excel-okuma-ve-repeater-yukleme</link>
					<comments>https://www.sanaldata.com/asp-net-ile-excel-okuma-ve-repeater-yukleme#respond</comments>
		
		<dc:creator><![CDATA[Burak]]></dc:creator>
		<pubDate>Mon, 21 Jun 2021 02:24:25 +0000</pubDate>
				<category><![CDATA[Asp.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Asp.Net Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. çözümü]]></category>
		<category><![CDATA[Asp.Net Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. solution]]></category>
		<category><![CDATA[asp.net office 2013 okuma]]></category>
		<category><![CDATA[asp.net xls okuma]]></category>
		<category><![CDATA[Asp.Net Xls Read]]></category>
		<category><![CDATA[asp.net xlsx okuma]]></category>
		<category><![CDATA[asp.net xlsx read]]></category>
		<guid isPermaLink="false">https://www.sanaldata.com/?p=336</guid>

					<description><![CDATA[<p>Merhaba arkadaşlar web tarafında kod yazarken excel&#8217;den import vsss işlemler yapmanız için aşağıdaki kodlar işinizi görücektir. Form tarafından 1 adet fileupload component ile upload işlemini yaptığınız varsayıyorum.Eğer excelden gelen verileri direk repeater bind edicekseniz aşağıdaki kodu kullanıcaksınız. YÖNTEM 1 Bu yol ile sadece xls uzantıları okuyabilirsiniz. [crayon-69f1c1e5cdfa5604526984/] Form tarafından Eval kısmında ise &#60;%#Eval(&#8220;Excel&#8217;deki sütun adı&#8221;) %&#62; [&#8230;]</p>
The post <a href="https://www.sanaldata.com/asp-net-ile-excel-okuma-ve-repeater-yukleme">Asp.net ile Excel Okuma ve Repeater Yükleme</a> first appeared on <a href="https://www.sanaldata.com">SanalData | Yazılım ve Teknoloji Haberleri Sitesi</a>.]]></description>
										<content:encoded><![CDATA[<p>Merhaba arkadaşlar web tarafında kod yazarken excel&#8217;den import vsss işlemler yapmanız için aşağıdaki kodlar işinizi görücektir. Form tarafından 1 adet fileupload component ile upload işlemini yaptığınız varsayıyorum.Eğer excelden gelen verileri direk repeater bind edicekseniz aşağıdaki kodu kullanıcaksınız.</p>
<h2>YÖNTEM 1</h2>
<p><span style="color: #ff0000;"><em><strong>Bu yol ile sadece xls uzantıları okuyabilirsiniz.</strong></em></span></p><pre class="urvanov-syntax-highlighter-plain-tag">System.Data.OleDb.OleDbConnection MyConnection;
            System.Data.DataSet DtSet;
            System.Data.OleDb.OleDbDataAdapter MyCommand;
            MyConnection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("/teknoloji/temp/") + rast + fonk.seo(excel_file.FileName) + ";Extended Properties='Excel 8.0;HDR=Yes'");
            MyCommand = new System.Data.OleDb.OleDbDataAdapter("select * from [Sayfa1$] where Urun_Kodu&lt;&gt;''", MyConnection);
            DtSet = new System.Data.DataSet();
            MyCommand.Fill(DtSet);
            excel_iceri_aktarim.DataSource = DtSet;
            excel_iceri_aktarim.DataBind();
            excel_iceri_aktarim.Dispose();</pre><p>Form tarafından Eval kısmında ise &lt;%#Eval(&#8220;Excel&#8217;deki sütun adı&#8221;) %&gt; şeklinde kullanıcaksınız.Yok ben satır satır alıcam diyorsanız aşağıdaki kodu kullanıyoruz.</p><pre class="urvanov-syntax-highlighter-plain-tag">string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("/teknoloji/temp/") + rast + fonk.seo(excel_file.FileName) + ";Extended Properties='Excel 8.0;HDR=Yes'";
                OleDbConnection objConn = new OleDbConnection(connectionString);
                objConn.Open();
                OleDbCommand ObjCommand = new OleDbCommand("SELECT * FROM [Sayfa1$] where Urun_Kodu&lt;&gt;''", objConn);
                OleDbDataReader objReader = ObjCommand.ExecuteReader();
                while (objReader.Read())
                {

                   response.write(objReader["Rulo_Eni"].ToString());

                }
                objReader.Dispose();
                ObjCommand.Dispose();
                objConn.Dispose();</pre><p></p>
<h2><strong>YÖNTEM 2</strong></h2>
<p><span style="color: #ff0000;"><em><strong>Bu yol ile hem .xls hemde .xlsx okuyabilirsiniz.</strong></em></span></p>
<p><em><strong>Form dizaynı</strong></em></p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;%@ Page Language="C#" AutoEventWireup="true" Debug="true" CodeFile="CS.aspx.cs" Inherits="_Default" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
    &lt;title&gt;Import Excel Data into GridView&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form id="form1" runat="server"&gt;
    &lt;div&gt;
        &lt;asp:FileUpload ID="FileUpload1" runat="server" /&gt;
        &lt;asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" /&gt;
   
        &lt;asp:GridView ID="GridView1" runat="server"    &gt;
        &lt;/asp:GridView&gt;
    &lt;/div&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre><p><em><strong>Codebehind kısmı</strong></em></p><pre class="urvanov-syntax-highlighter-plain-tag">using System;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Configuration; 

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnUpload_Click(object sender, EventArgs e)
    {
      
  if (FileUpload1.HasFile)
        {
            string FileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
            string Extension = Path.GetExtension(FileUpload1.PostedFile.FileName);           
 
            string FilePath = Server.MapPath("uploads/"+FileName);
            FileUpload1.SaveAs(FilePath);
            
            string conStr = "";
            switch (Extension)
            {
                case ".xls": //Excel 97-03
                    conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" + Server.MapPath("uploads/"+FileUpload1.FileName) + "';Extended Properties='Excel 8.0'";
                    break;
                case ".xlsx": //Excel 07
                    conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + Server.MapPath("uploads/"+FileUpload1.FileName) + "';Extended Properties='Excel 8.0'";
                    break;
            }
            OleDbConnection connExcel = new OleDbConnection(conStr);
            OleDbCommand cmdExcel = new OleDbCommand();
            OleDbDataAdapter oda = new OleDbDataAdapter();
            DataTable dt = new DataTable();
            cmdExcel.Connection = connExcel;

            //Get the name of First Sheet
            connExcel.Open();
            DataTable dtExcelSchema;
            dtExcelSchema = connExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
            string SheetName = dtExcelSchema.Rows[0]["TABLE_NAME"].ToString();
            connExcel.Close();

            //Read Data from First Sheet
            connExcel.Open();
            cmdExcel.CommandText = "SELECT * From [" + SheetName + "]";
            oda.SelectCommand = cmdExcel;
            oda.Fill(dt);
            connExcel.Close();

            //Bind Data to GridView
            GridView1.Caption = Path.GetFileName(FilePath);
            GridView1.DataSource = dt;
            GridView1.DataBind();               

        }
    } 
 
}</pre><p>Eğer herşeyiniz tamam fakat içeri aktar dediğinizde &#8221; <strong>Asp.Net Microsoft.ACE.OLEDB.12.0&#8242; provider is not registered on the local machine.</strong> &#8221; şeklinde hata alıyorsanız serverınızda veya bilgisayarınızda gerekli bileşenler yok demektir. Servera <a href="https://www.microsoft.com/en-us/download/details.aspx?id=13255"><strong>burdaki</strong> </a>bileşeni kurduktan sonra restart ettikten sonra kodlarınız çalışmaya başlayacaktır.</p>The post <a href="https://www.sanaldata.com/asp-net-ile-excel-okuma-ve-repeater-yukleme">Asp.net ile Excel Okuma ve Repeater Yükleme</a> first appeared on <a href="https://www.sanaldata.com">SanalData | Yazılım ve Teknoloji Haberleri Sitesi</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.sanaldata.com/asp-net-ile-excel-okuma-ve-repeater-yukleme/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
