Hello,
I have specified a default database in my web.config like this:
<dataConfigurationdefaultDatabase="scsLocal"/>
<connectionStrings>
<addname="scsLocal"connectionString="server=DRLSWARTEBRV;database=SCS;uid=******;password=******;"providerName="System.Data.SqlClient"/></connectionStrings>
Now I would like to configure a SQLDataSource control to use this default database, yet it prompts me for a connectionstring. I know I can program it in the code behind file (if I ommit connection string, it will use the default), but then I can make no use of the wizard for configuring the SQLDataSource which would safe me a lot of coding.
Is there a way to configure the SQLDataSource to use the default database that is specified in the web.config?
Thanks!
Veerle
Veerle:
<dataConfigurationdefaultDatabase="scsLocal"/>
I'm not sure about what you're trying to do with this but you can configure the SQLDataSource in your .aspx page like this:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:<the web.config parameter name>%>"
SelectCommand="You select query here"
<SelectParameters>
<if any>
</SelectParameters>
</asp:SqlDataSource>
Hope this will help.
No comments:
Post a Comment