Click here to Skip to main content
14,738,318 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,

It is my first time that I try the ASP.net and I have a little issue. I declared a variable into the C# file (string UID, DB, PSW). I don't know how I could retrieve the content of that variable in an asp.net file and make use of them into my connectionstring as below :

<asp:SqlDataSource ID="MyDataSource1" runat="server"

       ConnectionString="Server=THE_DB_VARIABLE;uid=NAME_VARIABLE;pwd=PSW_VARIABLE;"

       ProviderName="System.Data.OracleClient"

       selectcommand="Select ID, REPERTOIRERECEPTION, STATUS From QUEUEOUT">
       </asp:SqlDataSource>


Any help ?
Posted

1 solution

Ok I found it :

MyDataSource1.ConnectionString = "Server=" + this.Schema + ";uid=" + this.UID + ";pwd=" + this.PSW + ";";
 Page.DataBind();
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900