|
-
Mar 28th, 2004, 01:30 AM
#1
Thread Starter
New Member
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
-
Mar 28th, 2004, 05:49 PM
#2
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 ...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|