Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
GeneralRe: Abstracts: can I do better than this? Pin
pbalaga30-Dec-09 8:12
pbalaga30-Dec-09 8:12 
GeneralRe: Abstracts: can I do better than this? [modified] Pin
ProtoBytes30-Dec-09 8:35
ProtoBytes30-Dec-09 8:35 
GeneralRe: Abstracts: can I do better than this? Pin
MollyTheCoder30-Dec-09 8:36
MollyTheCoder30-Dec-09 8:36 
GeneralRe: Abstracts: can I do better than this? Pin
PIEBALDconsult5-Apr-10 15:33
mvePIEBALDconsult5-Apr-10 15:33 
GeneralRe: Abstracts: can I do better than this? Pin
MollyTheCoder5-Apr-10 17:00
MollyTheCoder5-Apr-10 17:00 
GeneralRe: Abstracts: can I do better than this? Pin
PIEBALDconsult5-Apr-10 17:39
mvePIEBALDconsult5-Apr-10 17:39 
AnswerRe: Abstracts: can I do better than this? Pin
petercrab30-Dec-09 17:00
petercrab30-Dec-09 17:00 
QuestionHow to use in c# SqlHierarchyId.GetDescendant(null,null)? [modified] Pin
dimitarmarinov30-Dec-09 2:21
dimitarmarinov30-Dec-09 2:21 
Today, I tried to move the logic of my code from the SQLServer to my C# code.
The task is simple: Create a new HierarchyID element which is the first child of the current.

At the server side, the code is

DECLARE @User   hierarchyid           
SELECT  @User = hierarchyid::Parse('/1/')
 INSERT USERS  (LOGIN,HID) 
        VALUES ('UserName', @User.GetDescendant(NULL, NULL)

O.K. Now I try to do the same logic in code like this:

SqlHierarchyId NewHID = new SqlHierarchyId();
 NewHID = SqlHierarchyId.Parse("/1/");
 NewHID = NewHID.GetDescendant(null,null);

but I receive an error
"Error 6 Argument '1': cannot convert from null to 'Microsoft.SqlServer.Types.SqlHierarchyId"

What I find in the Microsoft's documentation at http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.types.sqlhierarchyid.getdescendant(SQL.105).aspx[^]
sais that NULL is allowed.

Now what can I do in the case? Any Ideas?

p.s. I've designed a workaround meanwhile:
DECLARE @User hierarchyid            
SELECT  @User = hierarchyid::Parse('/1/')
SELECT  @User.GetDescendant(NULL,NULL).ToString() as Child

...and I get a dataset filled with the value of the child. But this is stupid, isn't it?

modified on Wednesday, December 30, 2009 8:42 AM

QuestionInvoke a function every time that a function is been added to my event Pin
bonzaiholding30-Dec-09 1:17
bonzaiholding30-Dec-09 1:17 
AnswerRe: Invoke a function every time that a function is been added to my event Pin
OriginalGriff30-Dec-09 2:01
mveOriginalGriff30-Dec-09 2:01 
AnswerRe: Invoke a function every time that a function is been added to my event Pin
petercrab30-Dec-09 16:56
petercrab30-Dec-09 16:56 
QuestionThreads, speed up calculations Pin
Renven30-Dec-09 1:01
Renven30-Dec-09 1:01 
AnswerRe: Threads, speed up calculations Pin
Rob Philpott30-Dec-09 1:17
Rob Philpott30-Dec-09 1:17 
GeneralRe: Threads, speed up calculations Pin
Renven30-Dec-09 1:31
Renven30-Dec-09 1:31 
AnswerRe: Threads, speed up calculations Pin
Luc Pattyn30-Dec-09 2:01
sitebuilderLuc Pattyn30-Dec-09 2:01 
AnswerCODE Pin
Renven30-Dec-09 2:22
Renven30-Dec-09 2:22 
GeneralRe: CODE Pin
Luc Pattyn30-Dec-09 3:00
sitebuilderLuc Pattyn30-Dec-09 3:00 
GeneralRe: CODE Pin
Renven30-Dec-09 3:27
Renven30-Dec-09 3:27 
GeneralRe: CODE Pin
Renven30-Dec-09 3:44
Renven30-Dec-09 3:44 
GeneralRe: CODE Pin
Luc Pattyn30-Dec-09 3:49
sitebuilderLuc Pattyn30-Dec-09 3:49 
GeneralRe: CODE Pin
harold aptroot30-Dec-09 3:49
harold aptroot30-Dec-09 3:49 
GeneralRe: CODE Pin
Daniel Grunwald30-Dec-09 3:50
Daniel Grunwald30-Dec-09 3:50 
GeneralRe: CODE Pin
Renven30-Dec-09 4:03
Renven30-Dec-09 4:03 
GeneralRe: CODE Pin
Luc Pattyn30-Dec-09 4:38
sitebuilderLuc Pattyn30-Dec-09 4:38 
GeneralRe: CODE Pin
Daniel Grunwald30-Dec-09 4:42
Daniel Grunwald30-Dec-09 4:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.