//Comm.Append (empty, 3, pad);
//byte[] version = {0x00, 0x0, 0x0, 0x71};
+ //Console.WriteLine ("Version: {0}", ClientVersion[3]);
Comm.Append (ClientVersion); // TDS Version 7
Comm.Append ((int)this.PacketSize); // Set the Block Size
Comm.Append (empty, 3, pad);
if ( param.TypeName == "decimal" || param.TypeName == "numeric") {
Comm.Append ((param.Precision !=0 ) ? param.Precision : (byte) 29);
Comm.Append (param.Scale);
+ // Convert the decimal value according to Scale
+ if (param.Value != null && param.Value != DBNull.Value &&
+ ((decimal)param.Value) != Decimal.MaxValue &&
+ ((decimal)param.Value) != Decimal.MinValue) {
+ decimal expo = new Decimal (System.Math.Pow (10, (double)param.Scale));
+ int pVal = (int)(((decimal)param.Value) * expo);
+ param.Value = (decimal)pVal;
+ }
}
+
+ /* VARADHAN: TDS 8 Debugging */
/*
- * VARADHAN: TDS 8 Debugging *
if (Collation != null) {
Console.WriteLine ("Collation is not null");
Console.WriteLine ("Column Type: {0}", colType);
Console.WriteLine ("Collation bytes: {0} {1} {2} {3} {4}", Collation[0], Collation[1], Collation[2],
Collation[3], Collation[4]);
+ } else {
+ Console.WriteLine ("Collation is null");
}
*/
//return ColumnValues [0].ToString ();
}
- protected override TdsDataColumnCollection ProcessColumnInfo ()
+ protected override void ProcessColumnInfo ()
{
- TdsDataColumnCollection result = new TdsDataColumnCollection ();
int numColumns = Comm.GetTdsShort ();
for (int i = 0; i < numColumns; i += 1) {
byte[] flagData = new byte[4];
string columnName = Comm.GetString (Comm.GetByte ());
TdsDataColumn col = new TdsDataColumn ();
- result.Add (col);
+ Columns.Add (col);
#if NET_2_0
col.ColumnType = columnType;
col.ColumnName = columnName;
col ["DataTypeName"] = Enum.GetName (typeof (TdsColumnType), xColumnType);
#endif
}
- return result;
}
public override void Unprepare (string statementId)