SqlCeDataAdapter adp = new SqlCeDataAdapter("select * from gmembers where GID = "+current_group, con);

What I was trying to do is to Select all the records from table gmembers where GID is a string variabe.
I would also like to mention that actuall data type of GID is INT.
probably I m using wrong syntax.
Thanks

I am not much good with queries but try putting a single quote around the variable:

SqlCeDataAdapter adp = new SqlCeDataAdapter("select * from gmembers where GID = '"+current_group"'", con);

[double post]

You can also add parameters to your commands. This makes your code much more readable and easier to work with if your query has a few parameters:

int current_group = 1;

    SqlDataAdapter adp = new SqlDataAdapter("select * from gmembers where GID = @GID", con);
    adp.SelectCommand.Parameters.AddWithValue("@GID", current_group);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.