I am creating a migration application to migrate data from one app to another.
using (var conn = new System.Data.SqlClient.SqlConnection(""))
{
conn.Open();
using (var cmd = conn.CreateCommand())
{
cmd.CommandText = "SELECT * from Client";
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
Client client = new Client();
client.Active = reader["ActiveStatus"] == DBNull.Value ? false: Convert.ToBoolean(reader["ActiveStatus"]);
client.Country = reader["Country"] == DBNull.Value ? 1 : Convert.ToInt32(reader["Country"]);
client.Info = reader["Information"] == DBNull.Value ? "" : (string)reader["Information"];
}
}
}
}
In the above, I need to get client.ProductId
from another table using the Id
. How can I create another query inside the above to get the data? Should I add a new command?