Updating/inserting data
<p>I created 3 tables</p>

<pre><code>Clients: Client_ID, Client_Name, Client_Status,
Employees:Emp_ID, Emp_Name, Emp_Role  
EmpJobs:EmpJob_ID, Emp_ID, Client_ID, Hours_Spent, Job_Date 
</code></pre>

<p>now I need a function where the user enters data (Hours_Spent, Job_Date) to EmpJobs based on Client_Name and Emp_Name. This is what I tried </p>

<pre><code>string constring = "Data Source=baker-pc;Initial Catalog=BakodahDB;Integrated Security=True";
string sqlQuery = (@"INSERT INTO EmpJobs (Hours_Spent, Job_Date)
            values (@Hours_Spent,@Job_Date) 
            INNER JOIN Clients
            ON EmpJobs.Client_ID=Clients.Client_ID
            INNER JOIN Employees
            ON EmpJobs.Emp_ID=Employees.Emp_ID
            WHERE Clients.Client_Name=@Client_Name AND Employees.Emp_Name=@Emp_Name");

SqlConnection conDataBase = new SqlConnection(constring);
SqlCommand sqlCommand = new SqlCommand(sqlQuery, conDataBase);
conDataBase.Open();
sqlCommand.CommandText = sqlQuery;
sqlCommand.Parameters.Add("@Hours_Spent",SqlDbType.Int).Value = comboBox3.SelectedItem;
sqlCommand.Parameters.Add("@Job_Date",SqlDbType.Date).Value = Convert.ToDateTime(dateTimePicker1.Text);
sqlCommand.Parameters.Add("@Client_Name", SqlDbType.VarChar).Value = comboBox1.SelectedItem;
sqlCommand.Parameters.Add("@Emp_Name", SqlDbType.VarChar).Value = comboBox2.SelectedItem;
sqlCommand.ExecuteNonQuery();
conDataBase.Close();
MessageBox.Show("Saved!");
</code></pre>

<p>What am i doing wrong? what's the correct way to do it?</p>