locked
DataSet Designer - Not able to use "GenerateDBDirectMethods" when using Stored Procedures problem RRS feed

  • Question

  • Hi!

    When using the dataset designer, I sometimes run into a relatively annoying problem.

    Scenario 1:
    I drop a datatable from the server explorer.
    In the wizard, I go back one step and tell it to generate the procedures for me.
    When I ge to the step where I can check "GenerateDBDirectMethods", I can do so.
    Everything works fine.

    Scenario 2:
    I have pre-prepared stored procedures.
    I drop a datatable from the server explorer.
    In the wizard I go back one step and tell it to use existing stored procedures.
    When I reach the step where I should be able to check "GenerateDBDirectMethods", I cannot.
    I also cannot set the property to True in the dataset properties window, whatever I do.

    Is this behavior by design, and if, why so? Where is the difference between both scenarios?

    Regards,

    Ziga Jakhel


    Monday, November 21, 2005 9:24 AM

Answers

  • Hi Ziga,

    It looks like you may have found a bug here. I don't believe the checkbox should be disabled when creating TableAdapters that use existing stored procedures. I will make sure this is forwarded on to the development team to investigate.

    For now, you can work around this by creating a new TableAdapter in the DataSet Designer by right-clicking on the designer surface and choosing Add->TableAdapter. Then go through the wizard choosing Use Existing Stored Procedures. The checkbox will still be disabled but it will be checked and the DBDirect methods will be created. You will also be able to turn on/off the GenerateDBDirectMethods property in the properties window by following this workaround.

    I hope this helps.

    Jay Hickerson
    Visual Basic Team
    Monday, November 21, 2005 9:51 PM

All replies

  • Hi Ziga,

    It looks like you may have found a bug here. I don't believe the checkbox should be disabled when creating TableAdapters that use existing stored procedures. I will make sure this is forwarded on to the development team to investigate.

    For now, you can work around this by creating a new TableAdapter in the DataSet Designer by right-clicking on the designer surface and choosing Add->TableAdapter. Then go through the wizard choosing Use Existing Stored Procedures. The checkbox will still be disabled but it will be checked and the DBDirect methods will be created. You will also be able to turn on/off the GenerateDBDirectMethods property in the properties window by following this workaround.

    I hope this helps.

    Jay Hickerson
    Visual Basic Team
    Monday, November 21, 2005 9:51 PM
  • Hi, Jay!

    Thanks for the workaround & the swift reply :)

    Otherwise the behaviour is really sporadic... if, for instance, I create a dataadapter using sql statements or have it create it's own procedures it works fine... so yes, it definitely smells like a bug.
    I already created a bug report via the feedback site... there were similar bugs in the betas but were supposed to have been fixed. Apparently not :(

    Thanks again for verifying.

    Regards,

    Ziga

    Monday, November 21, 2005 10:12 PM
  •  

    I am not able to implement this workaround. I right click and add a tableadapter. and follow the wizard selecting create new stored procedure selection and same error appears. are you saying that we have to create the stored procedures ahead of time and avoid using "Create Stored Procedure" selection or am I doing something wrong?

     

    Thanks

    Tuesday, October 2, 2007 1:24 AM
  • You can still set it manually. Open the XSD file in XML editor and navigate to your table adapter (say its named taCurrentVV) - just search for "taCurrentVV" in XSD. You will see something like this:

    <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="taCurrentVV" GeneratorDataComponentClassName="taCurrentVV" Name="CurrentVV" UserDataComponentName="taCurrentVV"
        <MainSource> 
            <DbSource ConnectionRef="ConnectionString (MySettings)" DbObjectName="IMPORT.CURRENTVV" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="False" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetData" UserSourceName="Fill"
                <DeleteCommand> 
    Just change value of GenerateShortCommands from False to True and it's done - now your methods are generated.

    Đ.
    Friday, January 30, 2009 9:08 AM
  • It works in Visual Studio 2013 :)
    Tuesday, July 5, 2016 6:27 PM