errorin where clause

Discussion in 'C#' started by azfarhus, Aug 28, 2010.

  1. azfarhus

    azfarhus New Member

    Joined:
    Aug 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I am trying to read some data from a db but I am getting an error on oledbdatareader.

    here is my code.
    Code:
     OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Power User\Desktop\Domains.accdb;Persist Security Info=False");
                conn.Open();
                OleDbCommand cmd = new OleDbCommand();
                cmd.Connection = conn;
                //cmd.CommandText = "Select * from Domains";
                cmd.CommandText = "Select * FROM Domains WHERE Domain= '" + TextBox1.Text + "'";
                OleDbDataReader dr = cmd.ExecuteReader();
                GridView1.DataSource = dr;
                GridView1.DataBind();
                conn.Close();
    
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice