/// 读取excel数据
private void button10_Click(object sender, EventArgs e)
{
string path = "C:/Users/Administrator/Desktop/打印/excel文件/test.xlsx";
System.Data.DataTable excelDt = ReadFromExcel(path);
//把Excel读取到DataTable里面 然后再把DataTable存入数据库
for (int j = 0; j < excelDt.Columns.Count; j++)
{
string xuhao = excelDt.Rows[j][0].ToString();
string tuhao = excelDt.Rows[j][1].ToString();
string tuname = excelDt.Rows[j][2].ToString();
string bumen = excelDt.Rows[j][3].ToString();
string shoujianname = excelDt.Rows[j]
Winform 读取本地Excel文件
于 2024-01-18 14:11:47 首次发布