X
xanthviper
Hey there,
I've been looking around for awhile now on how to do this and haven't
been able to really find a clear answer.
I have a stored procedure that inserts a new entry into a SQL 2000
table. The Stored Procedure(SP) accepts an ID that has been declared
as a UNIQUEIDENTIFIER in the SP, as well as in the Table (as primary
key).
I generate a GUID in my C# ASP.NET app and treat it as a string. In
passing it to the SP, I have the data type set to
SqlDbType.UNIQUEIDENTIFIER. Of course when running the function, I get
a problem stating I cannot cast a string to a uniqueidentifier. So in
order to solve this, I have set up the SP ID parameter to be
SqlDbType.Char, 37. This works fine. However, something tells me this
really isn't the proper way to do this. Could someone perhaps give me
the guidance as to what the proper way is to pass a uniqueidentifier to
stored procedure?
Thank you for your time.
I've been looking around for awhile now on how to do this and haven't
been able to really find a clear answer.
I have a stored procedure that inserts a new entry into a SQL 2000
table. The Stored Procedure(SP) accepts an ID that has been declared
as a UNIQUEIDENTIFIER in the SP, as well as in the Table (as primary
key).
I generate a GUID in my C# ASP.NET app and treat it as a string. In
passing it to the SP, I have the data type set to
SqlDbType.UNIQUEIDENTIFIER. Of course when running the function, I get
a problem stating I cannot cast a string to a uniqueidentifier. So in
order to solve this, I have set up the SP ID parameter to be
SqlDbType.Char, 37. This works fine. However, something tells me this
really isn't the proper way to do this. Could someone perhaps give me
the guidance as to what the proper way is to pass a uniqueidentifier to
stored procedure?
Thank you for your time.