select command for access database

OleDbCommand cmdpic = new OleDbCommand
          ("select * from sub_category where id_s=" 
            + Request.QueryString["id_s"] 
            +"or"+"order by sub_id desc", concars);

it shows error

what is the correct command

Answers


Actually, I think the real error was putting in the OR in the first place. The missing spaces would have caused a problem, but that was invalid syntax anyway -- select x from y where a=b or order by z is not valid in any SQL I have heard of.


 Request.QueryString["id_s"] 
        +"or"+"order by sub_id desc"

You have no spaces in there. Try this:

OleDbCommand cmdpic = new OleDbCommand
      ("select * from sub_category where id_s=" 
        + Request.QueryString["id_s"] 
        +" or "+"order by sub_id desc", concars);

OleDbCommand cmdpic = new OleDbCommand ("select * from sub_category where id_s=" + Request.QueryString["id_s"] +" or "+"order by sub_id desc", concars);

I believe you forgot spaces in the "Or"

And providing the error message is of course very helpful :)

Edit: It appears you should remove the OR indeed.


Need Your Help

update activity imageview from fragment webview javascript

javascript android android-fragments webview

There's a activity extends RoboFragmentActivity,it's main UI is a ViewPager to contain 3 fragments,xml below:

How do I determine what file is missing from the g++ compiler error?

c++ qt compiler-errors g++

I'm trying to compile some code (not mine) and I run into errors. I have a couple questions: