locked
VS2010 TableAdapter and GUID Parameters RRS feed

  • Question

  • With VS2010, I have a TableAdapter query that requires a GUID parameter which I cannot get to work either in preview mode or in code.

    eg:

    SELECT * from Test WHERE RecGuid=@MyGuid

    In preview mode you get the "Failed to convert parameter value from a String to a Guid" which apparently has been around for a long time, but when you try to pass a GUID to the GetDataBy... function created, there is no error message, nothing is returned and the debugger no longer stops at a break point.  All very strange.

    Can anyone replicate this and are there any workarounds for this (like changing the parameter type from GUID to string).

    • Moved by Brittany Behrens Tuesday, April 27, 2010 6:07 AM (From:Visual Studio Editor)
    • Moved by Barclay Hill Wednesday, April 28, 2010 7:44 PM More appropriate forum (From:Visual Studio Database Development Tools (Formerly "Database Edition Forum"))
    Thursday, April 22, 2010 2:12 AM

Answers

  • ok, so I was trying to use a tableadapter from my Data Access Layer, but VWD 2010 wasn't having any of that. It would simply throw that error

    "Failed to convert parameter value from a String to a Guid"

    It didn't matter if I chose to use SQL queries, or Stored Procedures, same error.

    The way I figured out what was wrong was to execute the SQL command with the parameters directly using SSMS directly on the table, which worked. But then when i tried the same thing from VWD via the DAL tableadapters the error would result. And also from my code since it was using the DAL.

    So I then executed the sp directly from SSMS and it worked, but again if I tried to execute it from VWD using the DAL, it failed.

    Finally, I simply bypassed the DAL and hard coded to the aspx page, and called the sp with the GUID param and *presto* that sucker worked.

    Friggin microsoft! Why is it that whenever they release a new product it has more bugs than a locust swarm?

     

     

    • Proposed as answer by Jangwar Friday, June 18, 2010 8:13 AM
    • Marked as answer by BTMI Thursday, June 24, 2010 1:44 AM
    Friday, June 18, 2010 8:12 AM

All replies

  • Hi BTMI

    I didn't verify this, but can you please try the workarounds mentioned there:

    http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/b3690c51-32fd-42cf-8c40-78407b9c4cc0

    https://connect.microsoft.com/SQLServer/feedback/details/127020/error-when-passing-guid-parameter-failed-to-convert-parameter-value-from-a-string-to-a-guid?wa=wsignin1.0

    Hope it help.

    thanks.


    Figo Fei
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Tuesday, April 27, 2010 8:40 AM
  • In this instance, because the database is not local, using stored procedures is not so good for me.  I am more concerned why I cannot populate the TableAdapter using a GUID...it seems a major omission to me.

     

    Thanks for your input though...

    Tuesday, April 27, 2010 10:26 AM
  • Hi... I've got the exact same issue and it's driving me nuts.

    Did you find a solution to this please?

    Friday, June 18, 2010 6:35 AM
  • ok, so I was trying to use a tableadapter from my Data Access Layer, but VWD 2010 wasn't having any of that. It would simply throw that error

    "Failed to convert parameter value from a String to a Guid"

    It didn't matter if I chose to use SQL queries, or Stored Procedures, same error.

    The way I figured out what was wrong was to execute the SQL command with the parameters directly using SSMS directly on the table, which worked. But then when i tried the same thing from VWD via the DAL tableadapters the error would result. And also from my code since it was using the DAL.

    So I then executed the sp directly from SSMS and it worked, but again if I tried to execute it from VWD using the DAL, it failed.

    Finally, I simply bypassed the DAL and hard coded to the aspx page, and called the sp with the GUID param and *presto* that sucker worked.

    Friggin microsoft! Why is it that whenever they release a new product it has more bugs than a locust swarm?

     

     

    • Proposed as answer by Jangwar Friday, June 18, 2010 8:13 AM
    • Marked as answer by BTMI Thursday, June 24, 2010 1:44 AM
    Friday, June 18, 2010 8:12 AM
  • That was ultimately what  I had to do as well.  Hopefully it will be fixed one day but I will not pass comment on MS until I come to the day when I can write flawless code.

    Thursday, June 24, 2010 1:46 AM