Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2006
    Posts
    4

    Unanswered: runtime error 80040e21

    I'm using VB6, and trying to update a table. It is all happening on my home
    pc with IIS running too. I can download the table to a datagrid, bit I can't
    type any text i a textbox and update it whith out the error occuring. Here
    is the code and some remarks afterwards:

    Code:
    Private Sub command2_click()
    
        Dim cn As ADODB.Connection
        Dim rs As ADODB.Recordset
        
        Set cn = New ADODB.Connection
        
        cn.Open "Provider=PostgreSQL.1;Password=***;User ID=postgres;Data
    Source=localhost;Location=***" ';Extended Properties="""
    
        Set rs = New ADODB.Recordset
        rs.CursorLocation = adUseClient
        rs.Open "select tilbudspris, materialer from efterkalk", cn,
    adOpenKeyset, adLockOptimistic
        
        rs.AddNew
    debug here ---  rs("tilbudspris").Value = Text1.Text
        rs("materialer").Value = Text2.Text
        rs.Update
        
        Set rs.ActiveConnection = Nothing
        Set rs = Nothing
        cn.Close
        Set cn = Nothing
    
    End Sub
    Remarks:
    The columns in the table is set to text.
    I've tried to write rs!tilbudspris and rs!materialer.
    I've tried to trim(text1.text)
    I've tried adopenstatic
    I've tried rs.movefirst

    I can't recognise where the problem should be.

    Pls help
    Last edited by loquin; 08-01-06 at 16:55.

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    try
    Code:
    rs.Open "select tilbudspris, materialer from efterkalk", cn,
    adOpenStatic, adLockOptimistic
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  3. #3
    Join Date
    Apr 2006
    Posts
    4
    It gives me the same error message at the same place

  4. #4
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Just for fun...

    Try inserting a record using the connection.execute method, without opening a recordset at all.
    Code:
    ' Open cn as before...
    dim strSQL as string
    strSQL = "Insert into efterkalk (tilbudspris, materialer) Values (' & Text1.Text & "', ' & Text2.Text & "')"
    
    cn.execute strSQL
    ' Close/Release cn
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

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