Ciao a tutti, sono nuovo del forum, complimenti a tutti.
Mi sto avvicinando ad asp.net ho fatto la seguente prova:
Ho creato un nuovo progetto in Visual Studio ed ho inserito il seguente listato:
-------------------------------------------------------
Imports System.Data.OleDb
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents conn As System.Data.OleDb.OleDbConnection
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim configurationAppSettings As System.Configuration.AppSettingsReader = New System.Configuration.AppSettingsReader()
Me.conn = New System.Data.OleDb.OleDbConnection()
'
'conn
'
Me.conn.ConnectionString = CType(configurationAppSettings.GetValue("conn.Conn ectionString", GetType(System.String)), String)
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim connstring As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\inetpub\wwwroot\dataapp\db1.mdb"
Dim cn As New OleDbConnection(connstring)
cn.Open()
cn.Close()
cn = Nothing
End Sub
End Class
------------------------------------------------------------------------------
il problema e che appena apro il progetto mi da il seguente errore:
![]()
![]()
![]()
Server Error in '/DataApp' Application.
--------------------------------------------------------------------------------
The Microsoft Jet database engine cannot open the file 'C:\inetpub\wwwroot\dataapp\db1.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: The Microsoft Jet database engine cannot open the file 'C:\inetpub\wwwroot\dataapp\db1.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
Source Error:
Line 34: Dim cn As New OleDbConnection(connstring)
Line 35:
Line 36: cn.Open()
Line 37:
Line 38: cn.Close()
Source File: C:\Inetpub\wwwroot\DataApp\WebForm1.aspx.vb Line: 36
Stack Trace:
[OleDbException (0x80004005): The Microsoft Jet database engine cannot open the file 'C:\inetpub\wwwroot\dataapp\db1.mdb'. It is already opened exclusively by another user, or you need permission to view its data.]
System.Data.OleDb.OleDbConnection.ProcessResults(I nt32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvid er() +57
System.Data.OleDb.OleDbConnection.Open() +130
DataApp.WebForm1.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\DataApp\WebForm1.aspx.vb:36
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +724
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.0; ASP.NET Version:1.0.3705.0
qualcuno sa spiegarmi dove sta il problema?
il db e' chiuso e alla cartella dove e' cotenuto il db ho assegnato il full control all'
utente everyone.
Il pc dove lavoro e' un pc in rete dove accedo con user e pass.
Vi prego aiutatemi non rieso proprio a capire :master::master:
![]()
P.s. Qualcuno sa dove posso trovare una buona guida per usare ado.net con asp.net e vb e i db access?
Grazie
Francesco

Rispondi quotando
