My code is as follows.
SqlCommand command = new SqlCommand();
command.Parameters.AddWithValue("@AccountId", accountNumberLong);
StringBuilder sql = new StringBuilder();
sql.AppendLine("SELECT * FROM T_POSTAGE_DISCOUNT");
sqlQuery = sql.ToString();
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
command.Connection = connection;
command.CommandType = CommandType.Text;
command.CommandText = sqlQuery;
SqlDataAdapter dataAdapter = new SqlDataAdapter(command);
dataAdapter.Fill(dsDiscounts, "Discounts");
}
upto here its working fine. I want to add another table to this dataset. Then I did like this.
command.Parameters.AddWithValue("@DISCOUNT_LEVEL_NBR",discountLevelNBR);
sql.AppendLine("select * from T_CONTRACT WHERE DISCOUNT_LEVEL_NBR=@DISCOUNT_LEVEL_NBR");
sqlQuery = sql.ToString();
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
command.Connection = connection;
command.CommandType = CommandType.Text;
command.CommandText = sqlQuery;
SqlDataAdapter dataAdapter = new SqlDataAdapter(command);
dataAdapter.Fill(dsDiscounts,"CONTRACT");
}
Its adding all the tables again. I want to add onlt contract table to existing datatset.
How can I do that?(c#)