Click here to Skip to main content
15,888,020 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hope someone can help (I am sure someone can :) )

Windows Server 2016

I have some ASP Classic pages that have HTML and ASP VB content mixed together that connect to a SQLite database to pull out some data and throw it into Combo boxes, Lists and so on. All works fine, but I want to bring it a little more into the future and need to update our aging ASP pages to ASPX. I dont want to use Visual Studio - since the ASP Classic pages were written using Notepad ++, I thought I would go along, see what the differences were and convert from there.

Things are going not too badly, but I am having a hell of an problem doing what I can do in ASP Classic, in ASPX. Downloading Nuget and getting the System.Data.SQLite ADO provider and installing and then having the following (stipped down to bare bones):

<%@ Import Namespace="System"%>
<%@ Import Namespace="System.IO"%>
<%@ Import Namespace="System.Net"%>
<%@ Import NameSpace="System.Web"%>
<%@ Import NameSpace="System.Data.SQLite"%>
<%@ Import NameSpace="System.Data.SQLite.Linq"%>


<html><head></head><body>


<%
Dim ConnStr as String="Data Source=" & Chr(34) & "C:\inetpub\wwwroot\WebSiteTest\test.db3" & Chr(34) & ";Version=3;Synchronous=On;count_changes=OFF;PRAGMA Journal Mode=On;cache=shared;Pooling=True;Max Pool Size=200;Cache Size=1048576;"

Using SQLDB As New SQLiteConnection
	SQLDB.ConnectionString = ConnStr
	SQLDB.DefaultTimeout = 0
	SQLDB.Open()
	
	
	SQLiteConnection.ClearPool(SQLDB)
	SQLDB.Close()
	SQLDB.Dispose()
End Using


	response.end()
	%>
</body></html>



When I refresh the page I get
Compiler Error Message: BC30002: Type 'SQLite.SQLiteConnection' is not defined.

I just cannot find out what is wrong, there seems to be very little on the internet via google, for doing the above.

What I have tried:

I have tried removing the SQLite. and just having a New SQLiteConnection but the error remains the same, just slightly different with Type error being 'SQLiteConnection' instead. I know I am close - its not referencing the DLLs properly for some reason, even though, even though the Import code works above as I can remove my connection code and then the page runs (giving a blank page).

Have tried using a Dim as New rather than the Using block, but the error is the same so its definitely not referencing it - I dont want to mess with the webconfig if possible and although I am using (elsewhere) a COM enabled .NET DLL that gets called in the old classic ASP, I could write the code into that, I would prefer to just write the code I need, referencing SQLite.

Looking at the Compiler error:

Microsoft (R) Visual Basic Compiler version 14.7.3062
for Visual Basic 2012
Copyright (c) Microsoft Corporation.  All rights reserved.

This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to Visual Basic 2012, which is no longer the latest version. For compilers that support newer versions of the Visual Basic programming language, see http://go.microsoft.com/fwlink/?LinkID=533241

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\10fc727c\d2f3abca\App_Web_znnoa53j.1.vb(22) : warning BC40056: Namespace or type specified in the Imports 'System.Data.SQLite' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

Imports System.Data.SQLite



I then NUGET installed the latest Roslyn compiler, made sure I nuget installed the latest SQLite which came back and said I already installed it so I am a bit confused as where I can go from here. I dont under why it is says "for Visual Basic 2012" though, do I need to install some other files (I am suspecting I do) ?

Update : I have put a bin directory in the same directory as my web page, copied SQLite DLL and the X86/X64 dir with dlls into that as well just in case, created a packages.config (as I was able to get this to run on my local dev machine (Windows 10 and IIS express, did not create a site, just created an ASP.net project, an ASPX page copy pasted what I have shown above into that through VS2017, "ran" the project it worked and did not fail, so copied some of the settings from webconfig and as I said the packages.config - still no luck, exact same error.
Posted
Updated 24-May-21 0:47am
v5

1 solution

Solved it:

Was the connection string, though I do not know if this is because I already have a driver installed that was the ASP Compatible one, or whether it is the ADO.NET - I <<think>> its the ADO.NET one.

Anyway having this:
DRIVER={SQLite3 ODBC Driver};Data Source=" & Chr(34) & "C:\inetpub\wwwroot\Test.db3" & Chr(34) & ";Version=3;Synchronous=On;count_changes=OFF;PRAGMA Journal Mode=ON;cache=shared;Pooling=True;Max Pool Size=200;Cache Size=1048576;"


solved the issue, I was able to query via a dataset and got my data returned.

Only took me 5 hours to figure it out....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900