簡體   English   中英

將Excel數據導入到SQL Server數據庫表並在gridview中顯示

[英]import excel data to sql server database table and display in gridview

如何將Excel數據導入到SQL Server數據庫表並在asp.net的gridview中顯示。 我已經完成了綁定部分,但我不知道如何導入Excel數據。

 SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=studentdetails;Integrated Security=True");
    SqlCommand cmd = new SqlCommand("select * from Table Name",con);
    con.Open();
    SqlDataReader rdr=cmd.ExecuteReader();
    GridView1.DataSource=rdr;
    GridView1.DataBind();

使用SQL Server Management Studio導入向導將excel導入數據庫中的表。 看這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM