亚音速等价查询用于此查询



谁能给我一个等效的查询以下MySQL查询:

string qry = "select @rownum := @rownum + 1 AS rowno, b_eventid as EventID,b_eventdata as 
                     EventData,b_machinetimestamp as MachineTime,b_hosttimestamp as HostTime";
       qry = qry + " from bm_transaction, (select @rownum := 0) r where b_terminalid=" +                      
                                 tid + " order by b_hosttimestamp desc";
          MySqlDataAdapter adp = new MySqlDataAdapter(qry, sqlcon);
            adp.Fill(dtLogs);

我的SubSonic查询样本是这样的:

DataTable dtlogs=new DataTable();
    try{
        arithmaticdataDB db=new arithmaticdataDB();
        IDataReader drreader=db.SelectColumns("b_eventid as EventID,b_eventdata as EventData,b_machinetimestamp as MachineTime,b_hosttimestamp as HostTime")
                              .From(" bm_transaction").Where("b_terminalid").IsEqualTo(tid).OrderDesc("b_hosttimestamp").ExecuteReader();

我如何将上面的更改为我的ADO的等价物。. NET查询在亚音速3.0.0.4?

如果我理解正确的话,第一个查询是带有值注入和重命名列的原始SQL。第二个例子似乎使用亚音速2。

在亚音速3我主要使用ActiveRecord和Linq。您的查询(非常粗略)可能看起来像:

var event_rows = b_transaction
  .Where(x => x.b_terminalid == tid)
  .OrderByDescending(x => x.hosttimestamp)
  .ToList();

相关内容

  • 没有找到相关文章

最新更新