I am pulling my selection string from my webapp. Its just a select .... from ... . I use this string multiple times however I would like to change order. Is there a way to write something like "<%$ AppSettings:SelectCustomer %> & ORDER BY CUST_NAME" ?
I tried a variety of ways just moving the ending " and such but nothing has worked. Any suggestions?
Thanks for the reply. I added this not sure if this is the correct way. Is there anyother way other than calling cofigurationmanager again?
Protected Sub ds_Selecting(sender As Object, e As SqlDataSourceCommandEventArgs)
e.Command.CommandText = ConfigurationManager.AppSettings("SelectCustomer") & (" ORDER BY CUST_NAME")
End Sub
Thanks for the reply. I added this not sure if this is the correct way. Is there anyother way other than calling cofigurationmanager again?
Protected Sub ds_Selecting(sender As Object, e As SqlDataSourceCommandEventArgs)
e.Command.CommandText = ConfigurationManager.AppSettings("SelectCustomer") & (" ORDER BY CUST_NAME")
End Sub
Hi,
Another two ways:
1) Directly use a common SQL statement instead of putting it in the app.config.
2) Use Stored Procdure, and then bind to SQLDataSource to execute to speed up your request of fetching out data contents.
joetinger
Member
6 Points
34 Posts
sqldatasource select command appsettings
Feb 06, 2013 05:58 PM|LINK
I am pulling my selection string from my webapp. Its just a select .... from ... . I use this string multiple times however I would like to change order. Is there a way to write something like "<%$ AppSettings:SelectCustomer %> & ORDER BY CUST_NAME" ? I tried a variety of ways just moving the ending " and such but nothing has worked. Any suggestions?
<asp:SqlDataSource ID="dataSourceCBCust" runat="server" ConnectionString = "<%$ ConnectionStrings:Customer %>" ProviderName = "<%$ ConnectionStrings:Customer.ProviderName %>" SelectCommand = "<%$ AppSettings:SelectCustomer %>" > </asp:SqlDataSource>MetalAsp.Net
All-Star
112718 Points
18367 Posts
Moderator
Re: sqldatasource select command appsettings
Feb 06, 2013 07:43 PM|LINK
Handle the selecting event of the datasource and use the event args parameter to set the command text etc.
joetinger
Member
6 Points
34 Posts
Re: sqldatasource select command appsettings
Feb 07, 2013 01:09 PM|LINK
Thanks for the reply. I added this not sure if this is the correct way. Is there anyother way other than calling cofigurationmanager again?
Protected Sub ds_Selecting(sender As Object, e As SqlDataSourceCommandEventArgs) e.Command.CommandText = ConfigurationManager.AppSettings("SelectCustomer") & (" ORDER BY CUST_NAME") End SubDecker Dong ...
All-Star
118619 Points
18779 Posts
Re: sqldatasource select command appsettings
Feb 08, 2013 12:50 AM|LINK
Hi,
Another two ways:
1) Directly use a common SQL statement instead of putting it in the app.config.
2) Use Stored Procdure, and then bind to SQLDataSource to execute to speed up your request of fetching out data contents.