SqlCeConnection sc = new SqlCeConnection();
string clientID = clientsDataSet1.ClientNames[0]["ClientID", DataRowVersion.Original].ToString();
int x = Int32.Parse(clientID);
try
{
sc.ConnectionString = Properties.Settings.Default.ClientsConnectionString;
//SqlCeCommand cmd = new System.Data.SqlServerCe.SqlCeCommand("INSERT INTO ClientTimes (ClientID) Values(" + row[0] + ") where not exist (select clientID from ClientNames where ClientID = " + row[0] + ");", sc);
// string fullName = String.Concat(tbFirstName.Text, " ", tbLastName.Text);
//string sqlCmd2 = "UPDATE ClientNames (ClientID, [First Name], [Last Name], [Full Name]) " +
// "Values(@ClientID,@FirstName,@LastName, @FullName);";
string sqlCmd3 = "DELETE FROM ClientNames WHERE ClientID = @ClientID;";
SqlCeParameter ParamClientID = new SqlCeParameter("ClientID", SqlDbType.Int);
ParamClientID.Value = x;
SqlCeCommand cmd2 = new SqlCeCommand(sqlCmd3, sc);
cmd2.Parameters.Add(ParamClientID);
sc.Open();
cmd2.ExecuteNonQuery();
sc.Close();
dataGridView1.DataSource = null;
dataGridView1.DataSource = clientsDataSet1.ClientNames;
}
catch (Exception ex)
MessageBox.Show(ex.ToString());
finally