错了。
select * from ajbh where dm='"& session("ajbh") &"'"只是一个字符串。你可以在你的控件中定义一个strcon的string属性。在程序中这样写。
假设objcon为sqlconnection
private _strcon as stringpublic property strcon() as string
            Get
                Return _strcon
            End Get
            Set(ByVal Value As String)
                _strcon= Value
            End Set
end propertydim cmd as new sqlcommand("_strcon,objcon)
..........在程序中直接把 select * from ajbh where dm='"& session("ajbh") &"'"赋给strcon就行了。

解决方案 »

  1.   

    你用的什么语言呀??“&”不需要呀?
      

  2.   

    在Page_Load中写yourcontrl.yourPro=yourvalue
      

  3.   

    private _strcon as string
    public property strcon() as string
                Get
                    Return _strcon
                End Get
                Set(ByVal Value As String)
                    _strcon= Value
                End Set
    end property
    这样之后在自定义控件里就有strcon这个属性了啊!我的就如文本框属性里一样啊!就和TEXT属性样!!
    我真接在面板里面给它这个值结果就变成了
    selectcmd="select * from ajbh where dm='"& session("ajbh") &"'"