后期绑定问题 [英] Late binding problem

查看:77
本文介绍了后期绑定问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的VS 2008代码中有以下内容:


参数(0).Value =会话(" User")。CompanyID


我认为这意味着因为没有用户在这一点上,我不能这样做。


但它会在那里而且用户对象有一个CompanyID属性。


如何在我的代码中访问它?


谢谢,


Tom

解决方案

我也有同样的问题:


Sub SetMoveList_Click(ByVal s As Object,ByVal e As EventArgs)

Trace.Warn(在SetMove_Click s.id ="& s.id)

Dim oPanel As Panel = s.parent

Dim oDLI As DataListItem = s.parent.parent


我在s.id,s.parent和s.parent.parent上收到错误。


我曾经在2003年这样做过 - 我怎么会在这里做同样的事情?


谢谢,


Tom


" tshad" < tf*@dslextreme.com写在留言中

新闻:eG ************** @ TK2MSFTNGP04.phx.gbl ...


>我的VS 2008代码中有以下内容:


parameters(0).Value = Session(" User")。CompanyID


我认为这意味着因为没有用户在这一点上,我不能这样做。


但它会在那里而且用户对象有一个CompanyID属性。


如何在我的代码中访问它?


谢谢,


Tom


" tshad" < tf*@dslextreme.com写在消息中

新闻:eG ************** @ TK2MSFTNGP04.phx.gbl ...


我的VS 2008代码中有以下内容:


parameters(0).Value = Session(" User")。CompanyID


我认为这意味着因为没有用户在这一点上,我不能这样做。


但它会在那里而且用户对象有一个CompanyID属性。


如何在我的代码中访问它?



您似乎使用的是VB.NET而不是C#,所以它可能是

之类的东西:


如果会话(用户)不是,那么

参数(0).Value =会话(" User")。CompanyID

结束如果

-

Mark Rae

ASP.NET MVP
http://www.markrae.net


tshad写道:


我的VS 2008代码中有以下内容:


参数(0).Value = Session(" User" ;)。CompanyID


我认为这意味着因为没有用户在这一点上,我不能这样做。


但它会在那里而且用户对象有一个CompanyID属性。


如何在我的代码中访问它?



嗨汤姆,

据我所知,你有CompanyID问题。

当时不知道(或者在VB.NET中有什么不同?)。在这种情况下,您必须将会话(用户)的结果转换为您期望的对象。也许这个

可以帮助你: http:/ /www.codeproject.com/KB/dotnet...astingNET.aspx

Best,

Hilmar


I have the following in my VS 2008 code:

parameters(0).Value = Session("User").CompanyID

I assume this means that since there is no "User" at this point I can''t do
this.

But it will be there and the User Object has a CompanyID property.

How can I access this in my code?

Thanks,

Tom

解决方案

I also have the same problem with:

Sub SetMoveList_Click(ByVal s As Object, ByVal e As EventArgs)
Trace.Warn("in SetMove_Click s.id = " & s.id)
Dim oPanel As Panel = s.parent
Dim oDLI As DataListItem = s.parent.parent

I am getting the error on s.id, s.parent and s.parent.parent.

I used to do this in 2003 - how would I do the same thing here?

Thanks,

Tom

"tshad" <tf*@dslextreme.comwrote in message
news:eG**************@TK2MSFTNGP04.phx.gbl...

>I have the following in my VS 2008 code:

parameters(0).Value = Session("User").CompanyID

I assume this means that since there is no "User" at this point I can''t do
this.

But it will be there and the User Object has a CompanyID property.

How can I access this in my code?

Thanks,

Tom



"tshad" <tf*@dslextreme.comwrote in message
news:eG**************@TK2MSFTNGP04.phx.gbl...

I have the following in my VS 2008 code:

parameters(0).Value = Session("User").CompanyID

I assume this means that since there is no "User" at this point I can''t do
this.

But it will be there and the User Object has a CompanyID property.

How can I access this in my code?

You appear to be using VB.NET instead of C#, so it''s probably something
like:

If Session("User") Is Not Nothing Then
parameters(0).Value = Session("User").CompanyID
End If
--
Mark Rae
ASP.NET MVP
http://www.markrae.net


tshad wrote:

I have the following in my VS 2008 code:

parameters(0).Value = Session("User").CompanyID

I assume this means that since there is no "User" at this point I can''t do
this.

But it will be there and the User Object has a CompanyID property.

How can I access this in my code?

Hi Tom,
as far as I see you have the problem that "CompanyID" is not known at
that moment (or is this different in VB.NET?). In that case you have to
cast the result of Session("User") to the object you expect. Maybe this
helps you: http://www.codeproject.com/KB/dotnet...astingNET.aspx

Best,
Hilmar


这篇关于后期绑定问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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