【发布时间】:2014-02-06 10:28:30
【问题描述】:
OleDbConnection con = new OleDbConnection(constr);
con.Open();
OleDbCommand Comm1 = new OleDbCommand("select customer_id from tb_customer ORDER BY customer_id desc limit 1", con);
OleDbDataReader DR_customer = Comm1.ExecuteReader();
if (DR_customer.Read())
{
textBox1.Text = DR_customer.GetValue(0).ToString();
}
在这里,我试图获取最后输入的数据的 customer_id。但我在 ORDER By 子句中遇到语法错误。
【问题讨论】:
-
不应该是
select top 1 customer_id而不是limit 1吗?限制是 MySQL 运算符 -
@user 查询限制后 1 是什么?
-
但我想要最后一个 id.??
-
你想连接什么数据库引擎?
-
如果 OP 使用的是 mySQL 怎么办?
标签: c#