代码隐藏中声明了Acess Cariables [英] Acess Cariables declared in codebehind

查看:107
本文介绍了代码隐藏中声明了Acess Cariables的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



这是我第一次尝试使用ASP.net而且有一点问题。我在C#文件中声明了一个变量(字符串UID,DB,PSW)。我不知道如何在asp.net文件中检索该变量的内容,并将它们用于我的connectionstring中,如下所示:



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 ?

推荐答案

好的我找到了:



Ok I found it :

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


这篇关于代码隐藏中声明了Acess Cariables的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆