Basically I am defining my database connection string from my global.asax (example from a book), but doing it in
vb.net 2003 standard is not as easy becuase it's too intelligent. Has anyone else done it this way before?
How do i implement this (below) db connection method with
vb.net 2003?? any know? U'd be greatful for any pointers.
This is what I have in my global.asax:
Code:
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
Dim strDbUrl As String
strDbUrl = Request.ApplicationPath
If Right(strDbUrl, 1) <> "/" Then
strDbUrl &= "/"
End If
strDbUrl &= "database/mywebdb.mdb"
Session("conClass") = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=& Server.MapPath(strDbUrl) &;"
End Sub
(note that the provider is all on one line on my file)
and opening the db from an aspx page would simply be:
conClass = NEW oleDbConnection(session("conclass"))
then u got open or close or wotever u need to do. But doing it this way in
VB.NET is not so easy as it refuses to compile correctly.
Thanks,
Dei