can't run classic asp code in header of aspx file

C

Chumley the Walrus

I'm trying to do some ASP date formatting in a separate include file
on my .aspx page, but I keep getting "Statement cannot appear within
method body, expected end of statement" error when running this page.
The header code begins as:


<%@ Page Language="VB" debug="true"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<!-- #include file=dayofweekparse.asp -->

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
Dim strConn as string
="SERVER=xxx.xxx.xx.xx;UID=xxxx;PWD=xxxx;DATABASE=xxxx;"
Dim strSQL as string ="select events from EventTable"
Dim Conn as New sqlConnection(strConn)
Dim Cmd as New sqlCommand(strSQL,Conn)
Conn.Open()
thedata.DataSource =
Cmd.ExecuteReader(system.data.CommandBehavior.CloseConnection)
thedata.DataBind()
End Sub


</script>


????????

Chumley
 
S

Steve C. Orr [MVP, MCSD]

I doubt you'll have much luck trying to mix ASP and ASP.NET in the same page
like that. They are run by two completely separate engines, so this kind of
thing is not supported.
If you really need them to display together you might be able to get away
with putting an ASP page in one frame and an ASP.NET page in another frame.
 
H

Hermit Dave

well i would suggest using iframe and set the src to the asp page you want
to display within asp.net page.

otherwise look up webclient class. you can refer to the asp file seperately.
read it into a string and then assign the html to a table cell

if you need any reference on specifics just let me know

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
 
M

Marina

Of course this won't work. The include file becomes part of the .aspx page,
which expects .NET code. You can't put classic ASP there, unless its .NET
equivalent happens to be the same.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top