Donate Share

SharpCore Framework

Tracker: Bugs

5 2 small bugs , SqlClientUtility class - ID: 1844677
Last Update: Attachment added ( nobody )

1- There is an error in SqlClientUtility at line 304
//command.Parameters[i].Value = CheckValue(values[i]);
must be replaced by
command.Parameters.Add(CheckValue(values[i]));

2- There is no GetInt16 method in SqlClientUtility calss.

it could be useful :

/// <summary>
/// Attempts to extract the requested column value from a DataRow.
/// </summary>
/// <param name="dataRow">The DataRow to extract the column value
from.</param>
/// <param name="columnName">The name of the column to extract the value
from.</param>
/// <param name="valueIfNull">The value to return if the requested column
value is null or DBNull.Value.</param>
/// <returns>The value contained in the requested column if the value is
not null or DBNull.Value, otherwise null.</returns>
public static short GetInt16(DataRow dataRow, string columnName, short
valueIfNull)
{
object value = GetObject(dataRow, columnName, null);
if (value != null)
{
if (value is short)
{
return (short) value;
}
else
{
return Int16.Parse(value.ToString());
}
}
else
{
return valueIfNull;
}
}

/// <summary>
/// Attempts to extract the requested column value from a SqlDataReader.
/// </summary>
/// <param name="dataReader">The SqlDataReader to extract the column
value from.</param>
/// <param name="columnName">The name of the column to extract the value
from.</param>
/// <param name="valueIfNull">The value to return if the requested column
value is null or DBNull.Value.</param>
/// <returns>The value contained in the requested column if the value is
not null or DBNull.Value, otherwise null.</returns>
public static short GetInt16(SqlDataReader dataReader, string columnName,
short valueIfNull)
{
object value = GetObject(dataReader, columnName, null);
if (value != null)
{
if (value is short)
{
return (short)value;
}
else
{
return Int16.Parse(value.ToString());
}
}
else
{
return valueIfNull;
}
}


Nobody/Anonymous ( nobody ) - 2007-12-05 07:20

5

Open

None

Nobody/Anonymous

None

None

Public


Comments




Log in to comment.

No follow-up comments have been posted.

Attached File ( 1 )

Filename Description Download
SqlClientUtility.cs Download

Change ( 1 )

Field Old Value Date By
File Added 257332: SqlClientUtility.cs 2007-12-05 07:20 nobody