I'm well versed on classes and OOP in PHP and Java but can't for the life of me get it to working in ASP classic using VB.
I'm getting no errors, a blank page is displaying.
I have the below in two files. If anyone can point me in the right direction I'd much appreciate it.
Default.asp
dbConnection.as p
I'm getting no errors, a blank page is displaying.
I have the below in two files. If anyone can point me in the right direction I'd much appreciate it.
Default.asp
Code:
<%@ Language="VBSCRIPT" %> <!-- #include file="dbConnection.asp" --> <% Dim odbConnection 'As New dbConnection Set odbConnection = New dbConnection %> <html> <head> <title>ASP Test</title> </head> <body> <% odbConnection.dbOpen odbConnection.getStatus odbConnection.dbClose %> </body> </html>
Code:
<% Class dbConnection Private conn Private conn_string Private status Private Sub Class_Initialize() End Sub Public dbOpen() Set conn = Server.CreateObject("ADODB.Connection") conn.conn_string = "Driver={MySQL ODBC 5.1 Driver};SERVER=localhost;Port=3306;Database=db;Uid=user;Pwd=pass" conn.Open status = 1 End Sub Public dbClose() conn.Close status = 0 End Sub Public getStatus() If status = 1 Then Response.Write "Database connection up" Else Response.Write "Database connection down" End If End Sub Private Sub Class_Terminate() End Sub End Class %>
Comment