siva_iaf
asked on
GUID
hi im trying to do this:
Dim MyGuid As Guid = New Guid("4FD19834JLKJF-FSKFF" )
Dim Author As AuthBl = New AuthBl(MyGuid)
here i couldnt pass the value of MyGuid...it alwyas shows its empty.
how to pass the exact value to myGuid .this myGUid is passed as a parameter to the stored procedure to retrieve the particular record from the table.
Dim MyGuid As Guid = New Guid("4FD19834JLKJF-FSKFF"
Dim Author As AuthBl = New AuthBl(MyGuid)
here i couldnt pass the value of MyGuid...it alwyas shows its empty.
how to pass the exact value to myGuid .this myGUid is passed as a parameter to the stored procedure to retrieve the particular record from the table.
ASKER
It shows me the foll error :
structure"system.Guid" cannot be indexed because it has no default property
in the line Guid.NewGuid()
structure"system.Guid" cannot be indexed because it has no default property
in the line Guid.NewGuid()
ok, if you are trying to view the Guid value in the quickwatch you wont see it not sure why. problem with the ide?? try this you will see s has a value of the guid
Dim MyGuid As Guid = Guid.NewGuid()
Dim s As String = MyGuid.ToString()
s += ""
Dim MyGuid As Guid = Guid.NewGuid()
Dim s As String = MyGuid.ToString()
s += ""
and if you need to pass the actual value just use
MyGuid.ToString()
MyGuid.ToString()
Dim MyGuid as Guid = Guid.NewGuid()
Dim Author As AuthBl = New AuthBl(MyGuid.tostring())
Dim Author As AuthBl = New AuthBl(MyGuid.tostring())
use the namespace
System.InteropServices
System.InteropServices
ASKER
Hello burakiewicz
Dim MyGuid As Guid = New Guid("4FD19834JLKJF-FSKFF" )
I want the assign the Guidvalue("4FD19834JLKJF-F SKFF") to myGuid .
Dim Author As AuthBl = New AuthBl(MyGuid as Guid)
here i cannot pass the parameter(MyGuid) as string.
Dim MyGuid As Guid = New Guid("4FD19834JLKJF-FSKFF"
I want the assign the Guidvalue("4FD19834JLKJF-F
Dim Author As AuthBl = New AuthBl(MyGuid as Guid)
here i cannot pass the parameter(MyGuid) as string.
you can pass it as a guid, but when you setup the parameter for the stored proc try it with the Guid.ToString()
The code you have should work perfectly fine, unless that's the actual value you're passing.
"4FD19834JLKJF-FSKFF" is not a valid ID, and will fail in the call to new Guid("....").
Since GUID is a value type, it always has a value, and will initialize to Guid.Empty.
Guid's must be 32 characters long, ie:
31B53463-4B4D-4C75-8EDE-65 21AA2C9F5A
20C15BFE-72AA-4040-B4F9-DE 4D7CFB0840
"4FD19834JLKJF-FSKFF" is not a valid ID, and will fail in the call to new Guid("....").
Since GUID is a value type, it always has a value, and will initialize to Guid.Empty.
Guid's must be 32 characters long, ie:
31B53463-4B4D-4C75-8EDE-65
20C15BFE-72AA-4040-B4F9-DE
And you should only convert it to a string when passing to the sp if the sp is actually expecting a varchar / nvarchar value.
But you should have it setup to expect a uniqueidentifier paramter, in which case you would pass the guid exactly as it is.
But you should have it setup to expect a uniqueidentifier paramter, in which case you would pass the guid exactly as it is.
you dont have on error resume next anywhere do you?
ASKER
hello snarf
I just gave the GUID value for an example.i know it is 32 character long and also the parameter expects a uniqueidentifier.I can pass it as a string and get it woking but i want to pass the value as GUID.
I just gave the GUID value for an example.i know it is 32 character long and also the parameter expects a uniqueidentifier.I can pass it as a string and get it woking but i want to pass the value as GUID.
Okay, so in the stored proc, what type is the parameter expecting? is it varchar / nvarchar or uniqueidentifier?
ASKER
uniqueidentifier
Can you post the .net code where you're calling the proc?
ASKER
I dont think that will help me
Dim MyGuid As Guid = New Guid("31B53463-4B4D-4C75-8 EDE-6521AA 2C9F5A")
I just wanted to know how to assign this value 31B53463-4B4D-4C75-8EDE-65 21AA2C9F5A to MyGuid.The above code assigns empty value to MyGuid.
Dim MyGuid As Guid = New Guid("31B53463-4B4D-4C75-8
I just wanted to know how to assign this value 31B53463-4B4D-4C75-8EDE-65
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
yeah thats the problem with the ide i mentioned. everthing you had should be working right, but it just wont look right in the debugger
ASKER
i got the result only after lot of comments
Dim Author As AuthBl = New AuthBl(MyGuid)