如何在视图数据中显示? [英] How show in a view data ?
本文介绍了如何在视图数据中显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要获取并显示DataTable中的数据
我尝试了什么:
I need to obtain and show the data that is in the DataTable
What I have tried:
DataTable dt = new DataTable();
conString = string.Format(conString, excelFile);
using (OleDbConnection connExcel = new OleDbConnection(conString))
{
using (OleDbCommand cmdExcel = new OleDbCommand())
{
using (OleDbDataAdapter odaExcel = new OleDbDataAdapter())
{
cmdExcel.Connection = connExcel;
connExcel.Open();
DataTable dtExcelSchema;
dtExcelSchema = connExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
connExcel.Close();
//Read Data from Specific Sheet And Range
connExcel.Open();
cmdExcel.CommandText = "Select * from [" + "5.2" + "$A6:R100000]";
odaExcel.SelectCommand = cmdExcel;
odaExcel.Fill(dt);
connExcel.Close();
}
}
}
推荐答案
A6:R100000];
odaExcel .SelectCommand = cmdExcel;
odaExcel.Fill(dt);
connExcel.Close();
}
}
}
A6:R100000]"; odaExcel.SelectCommand = cmdExcel; odaExcel.Fill(dt); connExcel.Close(); } } }
好吧,确定目标是解决问题的一半。
使用intellisense确定用于显示的方法/属性数据。我会给你更多指导,但我没有任何关于心灵阅读和其他相关技术的技能。
Well, identifying the goal is halfway to solving the problem.
Use intellisense to determine what method/property to use to "show the data". I would give you more guidance, but I don't have any skills regarding mind-reading and other associated technologies.
这篇关于如何在视图数据中显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文