日期:2014-05-20  浏览次数:20495 次

未将对象引用设置到对象的实例
Imports   System.Data
Imports   System.Data.OleDb
Public   Class   relation
        Inherits   System.Web.UI.Page

#Region   "   Web   窗体设计器生成的代码   "

        '该调用是   Web   窗体设计器所必需的。
        <System.Diagnostics.DebuggerStepThrough()>   Private   Sub   InitializeComponent()

        End   Sub
        Protected   WithEvents   lbllist   As   System.Web.UI.WebControls.Label

        '注意:   以下占位符声明是   Web   窗体设计器所必需的。
        '不要删除或移动它。
        Private   designerPlaceholderDeclaration   As   System.Object

        Private   Sub   Page_Init(ByVal   sender   As   System.Object,   ByVal   e   As   System.EventArgs)   Handles   MyBase.Init
                'CODEGEN:   此方法调用是   Web   窗体设计器所必需的
                '不要使用代码编辑器修改它。
                InitializeComponent()
        End   Sub

#End   Region
        Private   connectionstring   As   String   =   "provider=sqloledb.1;   data   source=localhost;   initial   catalog=pubs;   integrated   security=sspi "
        Private   Sub   Page_Load(ByVal   sender   As   System.Object,   ByVal   e   As   System.EventArgs)   Handles   MyBase.Load
                '在此处放置初始化页的用户代码
                If   Me.IsPostBack   =   False   Then
                        createlist()
                End   If
        End   Sub
        Private   Sub   createlist()
                Dim   selectsql   As   String
                selectsql   =   "select   au_lname,au_fname,au_id   from   authors "
                Dim   con   As   New   OleDbConnection(connectionstring)
                Dim   cmd   As   New   OleDbCommand(selectsql,   con)
                Dim   adapter   As   New   OleDbDataAdapter(cmd)
                Dim   dspubs   As   New   DataSet

                Try
                        con.Open()
                        adapter.Fill(dspubs,   "authors ")
                        cmd.CommandText   =   "select   au_id,title_id   from   titleauthor "
                        adapter.Fill(dspubs,   "titleauthor ")