none
What is called by Refresh Parameters button in provider? RRS feed

  • Question

  • Hello *,

     

    can somebody tell me, what methods of provider (if some) are called when I click "Refresh Parameters" button in SqlDataSource (see image)?

     

    In SqlClient I get - of course - parameters. But it doesn't work in our FirebirdClient. It looks like some "magic" Smile method on FbCommand (implementing IDbCommand) is/should be called to get these params.

     

    Thanks for any hint.

    PS: Can I debug this in any way? I.e. to step into (my) code? Or to see trace?

    Tuesday, October 7, 2008 8:19 PM

Answers

  • Hi Jiri,

    The "Refresh Parameters" feature of SqlDataSource's editors is unfortunately not extensible. This is in part due to a limitation of ADO.NET and the extensibility of the DbFactory APIs. The Refresh Parameters feature has two cases:

    1. Command text, such as "select * from authors where au_id = @au_id". In this case SqlDataSource has its own SQL parser and it knows a few different syntax patterns, but they are all hard-coded.

    2. Stored Procedures, such as "get_authors_by_id". In this case SqlDataSource has a hard-coded list of a few well-known .NET Framework providers and it calls into the appropriate one depending on what you have selected.

    Thanks,
    Eilon
    Tuesday, January 13, 2009 12:10 AM
  • Hi Eilon,

    thanks for reply. It's interesting. I have this code:
    <%-- Firebird --%> 
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
        SelectCommand="SELECT * FROM detail where 1 = @Param1">  
        <SelectParameters> 
            <asp:Parameter DefaultValue="3" Name="Param1" /> 
        </SelectParameters> 
    </asp:SqlDataSource> 
    <%-- MS SQL --%> 
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:testovaciConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:testovaciConnectionString.ProviderName %>" 
        SelectCommand="SELECT * FROM detail where 1 = @Param1">  
        <SelectParameters> 
            <asp:Parameter DefaultValue="3" Name="Param1" /> 
        </SelectParameters> 
    </asp:SqlDataSource> 

    It's same for Firebird as well as MS SQL. When I try to click on Refresh schema for MS SQL's SqlDataSource, it's asking me first for one parametr. For Firebird nothing - it is just trying to run command. :( Is there any different execution path for MS SQL and for other providers? Or do you have any idea what should be the cause of this behavior?
    Jiri {x2} Cincura
    Tuesday, January 13, 2009 8:55 AM

All replies

  • Do you have the source code for the FirebirdClient library?

     

    Wednesday, October 8, 2008 1:09 PM
  • Yep. Look at http://firebird.svn.sourceforge.net/svnroot/firebird/NETProvider/trunk/NETProvider/source/FirebirdSql/Data/ .
    Wednesday, October 8, 2008 1:11 PM
  • So if you can step through the FirebirdClient source code then you should be able to step through the .NET Framework source code as well.

     

    http://channel9.msdn.com/posts/DanielMoth/Debugging-Into-the-NET-Framework-Source-Code-with-Visual-Studio-2008/

     

    Wednesday, October 8, 2008 1:19 PM
  • Hi, problem is, that I don't know what method is called (some obvious I've tryied in my code by throwing exception, but no success Smile). And if I will use SqlClient how can I step into code if there's no my code to put breakpoint and use F11? And worse, the code is actually called by VS not from debugger. Sad
    Wednesday, October 8, 2008 7:44 PM
  • I see what you mean. I didn't realize you were using the designer tools until I was able to check out your screenshot. I'll see if I can get some more info on this.

     

    Thursday, October 9, 2008 1:13 PM
  • Hi Jiri,

    The "Refresh Parameters" feature of SqlDataSource's editors is unfortunately not extensible. This is in part due to a limitation of ADO.NET and the extensibility of the DbFactory APIs. The Refresh Parameters feature has two cases:

    1. Command text, such as "select * from authors where au_id = @au_id". In this case SqlDataSource has its own SQL parser and it knows a few different syntax patterns, but they are all hard-coded.

    2. Stored Procedures, such as "get_authors_by_id". In this case SqlDataSource has a hard-coded list of a few well-known .NET Framework providers and it calls into the appropriate one depending on what you have selected.

    Thanks,
    Eilon
    Tuesday, January 13, 2009 12:10 AM
  • Hi Eilon,

    thanks for reply. It's interesting. I have this code:
    <%-- Firebird --%> 
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
        SelectCommand="SELECT * FROM detail where 1 = @Param1">  
        <SelectParameters> 
            <asp:Parameter DefaultValue="3" Name="Param1" /> 
        </SelectParameters> 
    </asp:SqlDataSource> 
    <%-- MS SQL --%> 
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:testovaciConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:testovaciConnectionString.ProviderName %>" 
        SelectCommand="SELECT * FROM detail where 1 = @Param1">  
        <SelectParameters> 
            <asp:Parameter DefaultValue="3" Name="Param1" /> 
        </SelectParameters> 
    </asp:SqlDataSource> 

    It's same for Firebird as well as MS SQL. When I try to click on Refresh schema for MS SQL's SqlDataSource, it's asking me first for one parametr. For Firebird nothing - it is just trying to run command. :( Is there any different execution path for MS SQL and for other providers? Or do you have any idea what should be the cause of this behavior?
    Jiri {x2} Cincura
    Tuesday, January 13, 2009 8:55 AM
  • may be vs ide cannot dedect parameten prefix/suffix correctly ?

    because giving error about parameters

    "MUST declare command parameters"

    Sunday, July 30, 2017 10:06 PM