locked
system.nullreferenceexception : method : bindlist RRS feed

  • Question

  • User-1843363263 posted
    Hello...

    I am developing a  web mobile for my final-project at college. I got this error message when i try to show the page in emulator.:

    server error in / system.nullreferenceexception
    object reference not set to an instance of an object. method : bindlist

    stack trace :
    bindlist() line:31
    onviewstateexpire(eventargs e) line :16
    system.web.ui.mobilecontrols.mobilepage.loadpagestatefrompersistencemedium()
    system.web.ui.page.loadpageviews

    here is the code :

    <script runat="server">

       Sub command1_click(sender As Object, e As EventArgs)
        activeform=form2

    label5.text=kriteria.selection.value
    label5.font.bold=booleanoption.true
                         bindList
          
             End Sub
       
     protected overrides sub OnViewStateExpire(e as eventargs)
            bindlist()
         end sub
       
                 Sub bindList()           
        Dim objConn As OleDbConnection
                     Dim objCmd As OleDbCommand
                     Dim reader As OleDbDataReader
                     Dim strConn, strSQL As String
       

                     strConn = "Provider=Microsoft.Jet.OLEDB.4.0; " _
                        & "Ole DB Services=-4; " _
                        & "Data Source=" & Server.Mappath("Database\katalog_ndav.mdb")
       
    (line 16)                 strSQL ="SELECT namabrg,harga FROM [q_sparepart] WHERE [q_sparepart.kategori]" + "=" + "'" + kriteria.Selection.Value + "'" + "order by harga asc"
       
                     objConn = New OleDbConnection(strConn)
                     objCmd = New oledbcommand(strSQL, objConn)
                     objConn.Open()
       
                     reader = objCmd.ExecuteReader()
                    
       
       
         while reader.Read()
        
    textview1.text +=reader.Getstring(0) & "  :Rp  " & "<b>" & reader.getvalue(1).tostring() & "</b>"  & " " & "<br>"

       End While
       
                  reader.close()
                  objConn.Close()
              End Sub

    </script>
    <mobile:Form id="Form1" title="Sparepart" runat="server" Wrapping="Wrap">
        <Mobile:SelectionList id="kriteria" runat="server" selecttype="radio">
            <Item value="casing ATX" text="Casing ATX"></Item>
            <Item value="cdrom" text="CD/DVD Rom/RW"></Item>
            <Item value="floppy disk" text="Floppy disk"></Item>
            <Item value="harddisk" text="Harddisk"></Item>
            <Item value="memory" text="Memory"></Item>
            <Item value="powersupply" text="Power supply"></Item>
            <Item value="processor" text="Processor"></Item>
            <Item value="motherboard AMD" text="Motherboard AMD"></Item>
            <Item value="motherboard IP4" text="Motherboard Pentium 4"></Item>
            <Item value="sound card" text="Sound Card"></Item>
            <Item value="vga" text="VGA"></Item>
        </Mobile:SelectionList>
        <Mobile:Command id="Command1" onclick="command1_click" runat="server" SoftkeyLabel="cari">Pilih</Mobile:Command>
        <mobile:link id="link3" runat="server" stylereference="subcommand" navigateurl="pilihan1.aspx" alignment="center" softkeylabel="back">ke halaman sebelumnya</mobile:link>
    </mobile:Form>
    <mobile:Form id="Form2" runat="server" Wrapping="Wrap">
    <mobile:label id="label5" runat="server"></mobile:label><br><br>
      <mobile:textview id="textview1" runat="server"></mobile:textview>
           
      
        <mobile:link id="link1" runat="server" navigateurl="hargaA.aspx#form1">Back</mobile:link>
        <mobile:link id="link2" runat="server" navigateurl="home.aspx" softkeylabel="HOme">ke halaman Home</mobile:link>
    </mobile:Form>


    anybody plz help me......

    TIA

    regards,

    Hya

    Saturday, August 12, 2006 9:00 PM

All replies

  • User2119691303 posted
    At first glance i would say that kriteria.Selection.Value has not been set up correctly - make sure its created, populated and that the value has been selected.
    Friday, August 18, 2006 4:35 AM