Fix 1 for serialization - more problems ahead
This commit is contained in:
@@ -20,7 +20,7 @@ namespace Activizr.Database
|
||||
{
|
||||
int countryId = reader.GetInt32(0);
|
||||
string name = reader.GetString(1);
|
||||
string code = reader.GetString(2);
|
||||
string code = reader.GetString(2).ToUpperInvariant();
|
||||
string culture = reader.GetString(3);
|
||||
int geographyId = reader.GetInt32(4);
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Activizr.Database
|
||||
connection.Open();
|
||||
|
||||
DbCommand command =
|
||||
GetDbCommand("SELECT " + countryFieldSequence + " WHERE Code='" + countryCode.Replace("'", "''") + "'",
|
||||
GetDbCommand("SELECT " + countryFieldSequence + " WHERE Code='" + countryCode.ToUpperInvariant().Replace("'", "''") + "'",
|
||||
connection);
|
||||
|
||||
using (DbDataReader reader = command.ExecuteReader())
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Activizr.Database
|
||||
#region Field reading code
|
||||
|
||||
private const string postalCodeFieldSequence =
|
||||
" PostalCodes.PostalCode,Cities.CityName,Countries.CountryCode " +
|
||||
" PostalCodes.PostalCode,Cities.CityName,Countries.Code AS CountryCode " +
|
||||
" FROM PostalCodes " +
|
||||
" JOIN Cities ON (PostalCodes.CityId=Cities.CityId) " +
|
||||
" JOIN Countries ON (PostalCodes.CountryId=Countries.CountryId) ";
|
||||
@@ -42,7 +42,7 @@ namespace Activizr.Database
|
||||
|
||||
DbCommand command =
|
||||
GetDbCommand(
|
||||
"SELECT" + postalCodeFieldSequence + "WHERE Countries.CountryCode='" + countryCode.Replace("'", "''") + "';", connection);
|
||||
"SELECT" + postalCodeFieldSequence + "WHERE Countries.Code='" + countryCode.Replace("'", "''") + "';", connection);
|
||||
|
||||
using (DbDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
|
||||
@@ -207,11 +207,13 @@ namespace Activizr.Database
|
||||
|
||||
public BasicCity[] GetCitiesByCountry(string countryCode)
|
||||
{
|
||||
BasicCountry country = GetCountry(countryCode);
|
||||
|
||||
using (DbConnection connection = GetMySqlDbConnection())
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
DbCommand command = GetDbCommand("SELECT " + cityFieldSequence + " WHERE CountryCode='" + countryCode.ToUpperInvariant().Replace("'", "''") + "'",
|
||||
DbCommand command = GetDbCommand("SELECT " + cityFieldSequence + " WHERE CountryId=" + country.CountryId.ToString(),
|
||||
connection);
|
||||
List<BasicCity> result = new List<BasicCity>();
|
||||
using (DbDataReader reader = command.ExecuteReader())
|
||||
|
||||
Reference in New Issue
Block a user