>Hi everybody,
>
>I've tried to check few MSDN links, but it's still not clear to me. In our database we're using numeric(17,0) type for many Id columns - yes, I know, we should have used bigint instead to save space.
>
>Anyway, I am wondering how should I declare it correctly in C# and how to pass correctly using ADO.NET
>
>And also, what about CHAR(6) fields - should I use SqlDbType.Char or Varchar for parameters declaration?
>
>Here is my current code - I appreciate some suggestions:
>
>
>String tnwwSaleId = Functions.GetParameterValue(parameters, "tnWWsale_id");
>
> if (!String.IsNullOrWhiteSpace(tnwwSaleId))
> {
> Decimal wwSaleId;
> if (Decimal.TryParse(tnwwSaleId, out wwSaleId) && wwSaleId>0)
> {
> sqlBuilder.Append(" wwsale_id = @wwSaleId");
> sqlCommand.Parameters.Add("@wwSaleId",SqlDbType.Decimal, 17).Value = wwSaleId;
> }
> }
If it's always 6 char and, since char in .net is a unicode value wouldn't nchar(6) be the logical choice ?