private void display_companyName_atUpdateMode()
{
Int32 comID = 0;
using (SqlConnection con = new SqlConnection(Connectionstring.Connection))
{
string query = "select CompanyID from Table_Interaction where InteractionID='" +Convert.ToInt32( InteractionID.ToString() )+ "' ";
using (SqlCommand cmd = new SqlCommand(query, con))
{
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
if (!reader.HasRows) return;
while (reader.Read())
{
comID=Convert.ToInt32(string.Format("{0}",reader[0]));
string query2 = "select CompanyName from Table_Client where CompanyID=@param";
SqlCommand cmd2 = new SqlCommand(query2, con);
cmd2.Parameters.AddWithValue("@param", comID);
SqlDataReader reader1 = cmd2.ExecuteReader();
if (!reader1.HasRows) return;
while (reader.Read())
{
comboBox_client.Text = string.Format("{0}", reader1[0]);
}
}
}
}
}
|