Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Skydolphin
Starting Member
43 Posts |
Posted - 2005-01-13 : 17:06:45
|
What is the correct syntax for passing a guid to a Sproc in C#. I'm getting an Invalid cast from System.String to System.Guid error.SqlCommand cmd2 = new SqlCommand("proc_Reports_GetSiteInfo", connection);cmd2.CommandType = CommandType.StoredProcedure; SqlParameter Parm = cmd2.Parameters.Add("@SiteID", SqlDbType.UniqueIdentifier);I've tried the following.Parm.Value = "'{" + drv["SiteID"] + "}'";Parm.Value = "'{" + drv["SiteID"].ToString() + "}'";Parm.Value = drv["SiteID"].ToString();Parm.Value = drv["SiteID"];Any help would be appreciated. I can't figure out what it wants.Thanks,RhondaRhonda |
|
Skydolphin
Starting Member
43 Posts |
Posted - 2005-01-13 : 17:12:42
|
I figured out my problem. I was using a field returned from an ealier sproc and it was returning it as a system.string instead of system.guid. DUH!!!RhondaRhonda |
 |
|
|
|
|