So I'm new to using asp.net with VB.NET and I'm running into this error:
Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
Source Error:
Line 1: Imports System.Data.SQLite
Line 2: Imports System.Diagnostics
Source File: C:\Projects\HousingInfo\HousingInfo\SQLiteDatabase.aspx.vb Line: 1
I believe from all my googling that it has something to do with this line:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SQLiteDatabase.aspx.vb" Inherits="SQLiteDatabase" %>
This is the code for the database:
Imports System.Data.SQLite Imports System.Diagnostics Public Class SQLiteDatabase Private Shared dbConnection As String Public Sub New() dbConnection = "Data Source=housingInfo.db" CreateTables() End Sub Public Sub New(file) dbConnection = String.Format("Data Source={0}", file) CreateTables() End Sub <System.Web.Services.WebMethod()> Public Shared Function CreateTables() Debug.WriteLine("Creating Tables") Dim connection = New SQLiteConnection(dbConnection) connection.Open() Try Dim stm As String = "CREATE TABLE IF NOT EXISTS houses(id INTEGER PRIMARY KEY AUTOINCREMENT, address TEXT, city TEXT, state TEXT, rented INTEGER)" Catch ex As Exception MsgBox("Can't create table: " & ex.Message) End Try Return Nothing End Function End Class I'm confused. Can I not have import statements in my code?