Davood Riazi

Davood Riazi

  • 1.7k
  • 471
  • 188.3k


Nov 27 2013 4:11 AM
when i use this code in my project in vs 2012 and my Database is Access it display an error in this line "  OleDbDataReader reader = command.ExecuteReader();" 

The error is :   " The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect."

what should i do for solving this error ?

Thanks for any help 



This is my code :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Configuration;

public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        string connectionString, queryString;
        connectionString = ConfigurationManager.ConnectionStrings["ostanConnectionString"].ToString();
        queryString = "SELECT FROM situation where state ='" + DropDownList1.SelectedValue + "'";
        using (OleDbConnection connection = new OleDbConnection(connectionString))
            OleDbCommand command = new OleDbCommand(queryString, connection);

            OleDbDataReader reader = command.ExecuteReader();

            while (reader.Read())


Answers (2)