Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2006
    Messaggi
    11

    [1.0 - ASP.NET] Aiuto non riesco a connettermi ad un db Access (Urgente - Pivello)

    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

  2. #2
    Utente di HTML.it L'avatar di Kahm
    Registrato dal
    Dec 2004
    residenza
    Rome
    Messaggi
    3,584
    per caso hai lasciato aperto access mentre lavori in asp.net?
    chiudilo,
    si, lo so , sembra strano pero' a quanto pare ad asp.net da fastidio il database aperto mentre cilavora lui

    se a te non dovesse dare errori mentre è aperto(raro ma è successo), assicurati di non aver la sciato qualche tabella in modalita' struttura
    NN vi diro mai chi sono in realta,
    tutti i miei 3D sono orfani, non insistete per farmi rispondere ai 3D aperti da me

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2006
    Messaggi
    11
    Access è chiuso, pensando che la sessione fosse rimasta aperta ho acnhe riavviato il pc senza riaprire il db ma aprendo direttamente la pagina net creata, ma nulla!

    che faccio? :master:

  4. #4
    Verifica i diritti di accesso: l'utente IUSR_NomeComputer deve avere diritti di scrittura sul file MDB.

    Ciao!
    "Le uniche cose che sbagli sono quelle che non provi a fare."
    Atipica

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.