c# - MS-Access Query Syntax -
i have background of mysql. working on ms-access c#. tried following sql queries throws exception
queries 1:
string strsql = "select * employees orderby employeeid desc limit 1;"; oledbdataadapter adapter = new oledbdataadapter(strsql, conn); adapter.fill(dt); string strsql = "select * employees orderby employeeid asc limit 1;"; oledbdataadapter adapter = new oledbdataadapter(strsql, conn); adapter.fill(dt);
common exception 1:
additional information: syntax error in clause.
queries 2:
string strsql = "select * employees employeeid = (select min(employeeid) employees employeeid < '" + int64.parse(this.txtboxid.text) + "');"; oledbdataadapter adapter = new oledbdataadapter(strsql, conn); adapter.fill(dt); string strsql = "select * employees employeeid = (select min(employeeid) employees employeeid > '" + int64.parse(this.txtboxid.text) + "');"; oledbdataadapter adapter = new oledbdataadapter(strsql, conn); adapter.fill(dt);
common exception 2:
additional information: data type mismatch in criteria expression.
my database below
why don't create queries in access using query designer, change sql view , copy sql code?
also, think access have put-
select top 1 * employees;
rather than
select * employees limit 1;
Comments
Post a Comment