Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2009
    Posts
    4

    Red face Unanswered: Error 3709 using Data Environment

    Please, please, I need help. For days I'm trying to figure it out what is wrong - the same code that I usually used in other forms, now it doesn't work, no matter what I'm modifying:

    With DataEnvPS.PS
    If .State Then .Close
    .Open
    End With
    sSQL = "SELECT * FROM Clienti"
    DataEnvPS.Commands("cmdJustInCase").CommandText = sSQL
    DataEnvPS.Commands("cmdJustInCase").Execute
    With DataEnvPS.rscmdJustInCase
    If .State Then .Close
    .Open sSQL, , adOpenStatic, adLockReadOnly
    End With

    I wrote a very simple SQL statement just to see it working, but no, at the .Execute line it gives me Error 3709 "The connection cannot be used to perform this operation. It is either close or invalid in this context."

  2. #2
    Join Date
    Jan 2009
    Posts
    4

    Finally, I found what was wrong

    I had a DataGrid on my form, bound to that recordset in design. I left the datagrid unbound (.DataMember and .DataSource blank) and I added the following code and it worked!!!!

    With DataGrid1
    .DataMember = "cmdJustInCase"
    Set .DataSource = DataEnvPS
    .Refresh
    .Visible = True
    End With
    DataEnvPS.rscmdJustInCase.Close

  3. #3
    Join Date
    Jan 2009
    Posts
    4

    Still help wanted

    My joy was for a short time.
    When I wanted to change the SQL statement (repeated search), the same error came in.
    Does anybody know what can I do?

  4. #4
    Join Date
    Jan 2009
    Posts
    4
    Finally, after a lot of forum people said that "Data Environment is evil, don't use it!", I solved the problem due to Aslan. Hurray! For all the vb programmers who faced a similar problem, this is the only one working solution.

Posting Permissions

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