Skip to content

Commit

Permalink
Merge pull request #41 from akromm/release-0.8.12-sql-fix
Browse files Browse the repository at this point in the history
Release 0.8.12 sql fix
  • Loading branch information
markcowl committed Dec 11, 2014
2 parents cff8786 + d455de1 commit cbd4172
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -467,22 +467,29 @@ private string GetCommandKey()
{
string value;

switch (parameter.DbType)
if (parameter.Value == DBNull.Value)
{
case DbType.AnsiString:
case DbType.AnsiStringFixedLength:
value = (string)parameter.Value;
break;
case DbType.String:
case DbType.StringFixedLength:
value = (string)parameter.Value;
break;
case DbType.Boolean:
value = (bool)parameter.Value ? "1" : "0";
break;
default:
value = parameter.Value.ToString();
break;
value = string.Empty;
}
else
{
switch (parameter.DbType)
{
case DbType.AnsiString:
case DbType.AnsiStringFixedLength:
value = (string)parameter.Value;
break;
case DbType.String:
case DbType.StringFixedLength:
value = (string)parameter.Value;
break;
case DbType.Boolean:
value = (bool)parameter.Value ? "1" : "0";
break;
default:
value = parameter.Value.ToString();
break;
}
}

key = key.Replace(parameter.ParameterName, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public Database[] GetDatabases()
command.CommandText = getDatabaseQuery;
DbParameter param = command.CreateParameter();
param.ParameterName = "@name";
param.Value = null;
param.Value = DBNull.Value;

command.Parameters.Add(param);

Expand Down

0 comments on commit cbd4172

Please sign in to comment.