我是新来的,我已经看过一些示例代码,并发现读取基于键的行。从任何特定表读取所有行的方法是什么。就像我们在sql中所做的
“从Table_Name中选择*”
发布于 2013-07-16 12:21:15
EDB没有像在SQL中那样使用查询的选项。相反,您可以使用esent API提供的函数来访问数据库。最终会是这样的:
CreateInstance
初始化
BeginSession
AttachDatabase
OpenDatabase
OpenTable
RetrieveColumns (这是您实际读取数据的地方)
..。
当然,有许多功能和特性可以加快数据库事务的速度。但是,您必须处理下面提到的其中一个接口:
您可以尝试使用Microsoft提供的API。它有很好的文档,并且可以在这里免费获得:可扩展存储引擎
也可以使用托管Esent接口,您可以轻松地与Visual:ESENT管理互操作一起使用该接口
发布于 2021-02-16 01:40:44
可扩展存储引擎(ESE)中没有查询处理器。这意味着没有任何组件可以将文本查询转换为代码。
在术语中,ESE是一种索引顺序访问方法(ISAM)。
这意味着,如果您想查询一个客户:
SELECT FirstName, LastName FROM Customers
WHERE AccountNumber = 6191128你必须:
6191128在伪码中:
//Use the InvoiceDate index on invoices
db.SetCurrentIndex("IX_Invoices_InvoiceDate");
db.ClearSearchPredicate();
db.AddSearchPredicate(SEEK_GreaterOrEqual, "20170801");
db.AddSearchPredicate(SEEK_LessThen, "20180901");
//read matching primary keys into list
List<Guid> invoiceIDs = new List<Guid>();
IDataReader rdr = db.GetResults();
while (rdr.Read()) do
{
invoiceIDs.Add(rdr.GetGUID("InvoiceGUID"));
}
//Now use the primary clustered key to read the invoice numbers, and customer IDs
db.SetCurrentIndex("PK_Invoices");
for (Guid invoiceID in invoiceIDs) do
{
db.ClearSearchPredicate();
db.AddSearchPrediate(SEEK_Equal, invoiceID);
rdr = db.GetResults();
if rdr.Read() then
{
//todo: store these in another list
customerID = rdr.GetInt32("CustomerID");
invoiceNumber = rdr.GetInt32("InvoiceNumber");
}
}
//Now seek for customers by customerID
db.ClearSearchPredicate()
db.AddSearchPredicate(SEEK_Equal, customerID);
rdr = db.GetResults();
if rdr.Read() then
{
String name = rdr.GetString("Name");
String isActive = rdr.GetString("IsActive");
}https://stackoverflow.com/questions/17651361
复制相似问题