Hello,
How do I insert a local variable into a select statement when using the Oracle DB connecter in asp.net 2.0
When I run this, I get no result. as the USERID doesn't seem to be fetting set. I realize that I'm probably doing something silly with this but I'm rather new with ASP.net and I'm trying to understand wherre I'm going wrong. Thanks for your help.
How do I insert a local variable into a select statement when using the Oracle DB connecter in asp.net 2.0
Code:
In Code Behind: I set this the string to be the users id: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Dim strNTUser As String Dim iPos As Integer strNTUser = RTrim(Request.ServerVariables("LOGON_USER")) iPos = Len(strNTUser) - InStr(1, strNTUser, "\", CompareMethod.Binary) strNTUser = Right(strNTUser, iPos) End Sub In ASP I try to use the value of strNTUser as the where clause condition: <asp:SqlDataSource ID="oraDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:oraDB %>" ProviderName="<%$ ConnectionStrings:oraDB.ProviderName %>" SelectCommand='SELECT * FROM "MY_ASSOCIATES" WHERE ("USERID" = :USERID)'> <SelectParameters> <asp:SessionParameter Name="USERID" SessionField="strNTUser" Type="String" /> </SelectParameters>
Comment