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

enter image description here

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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -