Link to home
Start Free TrialLog in
Avatar of iulianchira
iulianchira

asked on

Nullable GUIDs

n my database, in one of the table I have a GUID column with allow nulls. I have a method with a Guid? parameter that inserts a new data row in the table. However when I say myNewRow.myGuidColumn = myGuid I get the following error: "Cannot implicitly convert type 'System.Guid?' to 'System.Guid'."
Avatar of divyeshhdoshi
divyeshhdoshi

please use guidcolumn= system.Guid.NewGuid()
Avatar of iulianchira

ASKER

I do not want to a new GUID, i allready have the GUID I want to insert.
but in whatever guid it should have some value.
otherwise it will insert null in guid column.

like You have created a guid
System.Guid g=System.Guid.NewGuid()

you can not use this one
System.Guid g=new System.Guid() will create guid with blank.

I want to have null sometimes in the column.
ASKER CERTIFIED SOLUTION
Avatar of openshac
openshac

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or in your case
myNewRow.myGuidColumn = (Guid)myGuid ;

Open in new window