Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection("Data Source=.;Integrated Security=true;Initial Catalog=myproject");
        SqlCommand cmd = new SqlCommand("Select * from room where roomstatus like occupied'",con);
        con.Open();
     
        GridView1.DataSource =cmd.ExecuteReader();
        GridView1.DataBind();
        con.Close();

    }




Error : Unclosed quotation mark after the character string ''
Posted
Updated 26-Oct-13 23:31pm
v3

Try:
C#
SqlCommand cmd = new SqlCommand("Select * from room where roomstatus like 'occupied'",con);

You forgot a single quote.
 
Share this answer
 
v3
SqlCommand cmd = new SqlCommand("Select * from room where roomstatus like occupied'",con);


occupied'"


after occupied remove this extra single quote
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900