Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Decimal type initialization
Message
From
25/01/2013 04:00:14
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01563996
Message ID:
01564033
Views:
29
>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 ?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform