vb net sub function where do i put them

J

jcharth

Hello I am trying to write a aspx webpage that grabs data from a access
database. It seems to work but I am trying to avoid repeating all code.
Can i declare i sub or function somewhere in the aspx file to avoide
repeating things? I just cant seem to find any samples that have a
funtion in the code. Can anyone post a tiny sample that prints html
tags and functions in a single file? thanks.
 
J

jcharth

Got it, a little complicate to find an example but i think i was all
about placing
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<script language="VB" runat="server">
 
C

Cor Ligthert [MVP]

Jchart,

In OOP this is what you do by using classes. (The DataAccessLayer class
often named in this case).

You can make a class containing all your data handling and instance that in
every page.

You can as well use a shared class (a kind of module). Be aware that you can
normally not hold data (beside constants) in a shared class for ASPX (or
that goes in a very difficult way).

The easiest way using this is in code behind by the way.

I hope this helps,

Cor
 

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

Top