using System.Data.SqlClient;
private void button1_Click(object sender, EventArgs e)
{
string conString = "Data Source=MyData.sdf;Persist Security Info=False;";
string lg = "select username, password from creds where username= '" + txtusername + "' and password= '" + txtpassword + "'";
SqlCeConnection con = new SqlCeConnection();
con.ConnectionString = conString;
SqlCeCommand selectCmd = con.CreateCommand();
selectCmd.CommandText = lg;
SqlCeDataAdapter adp = new SqlCeDataAdapter(selectCmd);
DataSet ds = new DataSet();
adp.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
MessageBox.Show("success!");
else
MessageBox.Show("no data exists");
}