Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB COM DLL doesn't allow to update data from database using ADO

VB COM DLL doesn't allow to update data from database using ADO

Scheduled Pinned Locked Moved Visual Basic
databasecomhelpsysadmin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vertigo_one
    wrote on last edited by
    #1

    Hi, I'm creating a COM Dll using VB6, I created simple functions to make an update on a database, but it doesn't work, I'm using an ASP Page that succesfully create the object but gives me errors when I try to insert or update data (Also I tried creating the object from other VB Application but didn't work either, 'weird' but when I use this code on a EXE it works, but I need this in a COM Dll).

    VB Dll Code

    Public Function Save() Dim Cn As New ADODB.Connection Cn.ConnectionTimeout = 100 Cn.ConnectionString = "DBQ=test.mdb;" & _ "DRIVER={Microsoft Access Driver (*.mdb)};" & _ "DefaultDir=C:\My Docs\My Source Code\VB\ASP-COM Test;" & _ "UID=admin; PWD=;" Cn.Mode = adModeReadWrite Cn.Open Cn.Execute "INSERT INTO tests (test_value) VALUES ('test3')" Cn.Close Save = True End Function

    ASP page code

    <% Dim iTest Set iTest = Server.CreateObject("TestProject.Test") Response.Write iTest.Save %> Like this it returns this error Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query. /xue2/index.asp, line 6 I also tried using a RecordSet Object but gives this error: Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only. /xue2/index.asp, line 6 Thanks if anyone can help! Vertigo

    H 1 Reply Last reply
    0
    • V vertigo_one

      Hi, I'm creating a COM Dll using VB6, I created simple functions to make an update on a database, but it doesn't work, I'm using an ASP Page that succesfully create the object but gives me errors when I try to insert or update data (Also I tried creating the object from other VB Application but didn't work either, 'weird' but when I use this code on a EXE it works, but I need this in a COM Dll).

      VB Dll Code

      Public Function Save() Dim Cn As New ADODB.Connection Cn.ConnectionTimeout = 100 Cn.ConnectionString = "DBQ=test.mdb;" & _ "DRIVER={Microsoft Access Driver (*.mdb)};" & _ "DefaultDir=C:\My Docs\My Source Code\VB\ASP-COM Test;" & _ "UID=admin; PWD=;" Cn.Mode = adModeReadWrite Cn.Open Cn.Execute "INSERT INTO tests (test_value) VALUES ('test3')" Cn.Close Save = True End Function

      ASP page code

      <% Dim iTest Set iTest = Server.CreateObject("TestProject.Test") Response.Write iTest.Save %> Like this it returns this error Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query. /xue2/index.asp, line 6 I also tried using a RecordSet Object but gives this error: Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only. /xue2/index.asp, line 6 Thanks if anyone can help! Vertigo

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #2

      Hi I faced similar problems with {Microsoft Access Driver (*.mdb)}; provider try : OLEDB jet provider :

      "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=admin; Password=;" 
      

      and check http://www.connectionstrings.com [^]for more

      V 1 Reply Last reply
      0
      • H Hesham Amin

        Hi I faced similar problems with {Microsoft Access Driver (*.mdb)}; provider try : OLEDB jet provider :

        "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=admin; Password=;" 
        

        and check http://www.connectionstrings.com [^]for more

        V Offline
        V Offline
        vertigo_one
        wrote on last edited by
        #3

        Oh!, thank you for your answer, I tried before the same connection string with no positive results :confused: , but I found the solution :), it was not big deal, it was nothing in the code, it was a problem with permissions in the IIS Configuration :wtf: (Not using Anonymous Access [chosen by default when you create a virtual directory], the correct one was using the Integrated Windows Authentication.). I lost a complete day in a such thing :(( but it happens :sigh: . Anyway, Thx for your help, Vertigo

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups