Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2004
    Posts
    1

    Unanswered: Cannot update. Database or object are read-only

    I have to build application Excel (interface) - SQL Server (backend)

    I've created Data Source File "test.dsn" and tested succesfully.
    SQL Server database in on the other machine.
    This is a code that I am using.

    And error message I am geting is "Cannot update. Database or object are read-only".

    Dim cn As ADODB.Connection
    Dim strSQL As String

    Set cn = New ADODB.Connection
    cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\Documents and Settings\pd\Desktop\Development\test.xls;" & _
    "Extended Properties=Excel 8.0"


    strSQL = "INSERT INTO [DSN = test.dsn].Region Values(5, 'ab');"


    cn.Execute strSQL

    cn.Close
    Set cn = Nothing


    Read-only of databse properties is not selected.

  2. #2
    Join Date
    Aug 2002
    Location
    Prague
    Posts
    77
    If I get it right you're attempting to insert a row into excel. As long as I know it's not possible because you cannot update, insert records throught Jet provider. mojza

  3. #3
    Join Date
    Oct 2003
    Location
    Cape Town
    Posts
    38
    Your query is unclear . Understanding you are trying to update region table In sql database .
    if that's case you should then rather open an ODBC or OLE DB connection to SQL server

    cn.Provider = "sqloledb"
    cn.Properties("Data Source") = ServerName
    cn.Properties("Initial Catalog") = DatabaseName

    ' If Windows NT authentication.
    cn.Properties("Integrated Security")= "SSPI"

    'If SQL Authentication
    cn.Properties("User ID")= UserID
    cn.Properties("Password") = pwd

    ' Open the database.
    cn.Open


    Dim strSQL as string

    strSQL "INSERT INTO dbo.Region Values(5, 'ab')"

    cn.execute strSQL

    cn.close
    set cn = nothing
    Benone

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •