Results 1 to 2 of 2

Thread: error

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    1

    error

    hi wonder any one can help me out...

    i want to view a asp.net file in IE but was prompt this error msg
    line: 9
    Error: expected ";"

    below is my code

    <%@Import Namespace="System.Data"%>
    <%@Import Namespace="System.Data.OleDb"%>
    <%@ Page Language="vb" Codebehind="stocklist1.aspx.vb"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <title>WebForm2</title>
    <script runat="server">

    sub Page_Load
    dim dbconn,sql,dbcomm,dbread
    dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & server.mappath("erestaurant.mdb"))
    dbconn.Open()
    sql="SELECT item FROM stockList"
    dbcomm=New OleDbCommand(sql,dbconn)
    dbread=dbcomm.ExecuteReader()
    dim firstrow As Boolean = True

    while dbread.Read()
    DropDownList1.Items.Add(New ListItem(dbread(0).ToString()))
    End while

    dbread.Close()
    dbconn.Close()


    end sub

    sub test(sender As Object, e As EventArgs)
    session("temp")= selectItem.SelectedItem.Text
    response.redirect("stocklist2.aspx")
    end sub
    </script>

    what is wrong??
    any way to retifiy this error

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    There's no language definition in the script tag - so when you''ve put sub, the page doesn't know if you're trying to write in vb or js from any other language.

    You're also coding this asp vbs code on the same page as the html so are missing out on the managed, compiled code and realistic variable data type declaraion benefits of using asp.net's server side, code behind pages.

    I would try & read up on "code behind" in the msdn library - it'll save you time coding & you're web applictions will be far more efficient in running if you can grasp this ...

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width