"Operation is not allowed when the object is closed..."
"Operation is not allowed when the object is closed..."
"Operation is not allowed when the object is closed..."
"Operation is not allowed when the object is closed..."
"Operation is not allowed when the object is closed..."
"Operation is not allowed when the object is closed..." "Operation is not allowed when the object is closed..." "Operation is not allowed when the object is closed..." "Operation is not allowed when the object is closed..." "Operation is not allowed when the object is closed..." "Operation is not allowed when the object is closed..." "Operation is not allowed when the object is closed..." "Operation is not allowed when the object is closed..."
"Operation is not allowed when the object is closed..." "Operation is not allowed when the object is closed..."
"Operation is not allowed when the object is closed..."
Go Back  Xtreme Visual Basic Talk > > > "Operation is not allowed when the object is closed..."


Reply
 
Thread Tools Display Modes
  #1  
Old 05-21-2011, 12:29 PM
ronnie1988 ronnie1988 is offline
Newcomer
 
Join Date: May 2011
Posts: 1
Default "Operation is not allowed when the object is closed..."


I searched, I found another post, but didn't quite understand the answer... Here is what I am working with... Anyways I know the connection is good it does update it by 10 then give me the error...

I am using Visual Basic 6

Code:
Private Sub Form_Load()
Dim sql As String
sql = "select * from Stats ORDER BY Hours"
With ADO
.ConnectionString = "Driver={MySQL ODBC 3.51 Driver};Server=www.*****.com;Port=3306;Database=*****;User=*****; Password=*****;Option=3;"
.RecordSource = sql
.Refresh

Set DataGrid1.DataSource = ADO
    DataGrid1.Columns(0).Width = 0


End With

End Sub


Private Sub Timer1_Timer()
Set Service = GetObject("winmgmts:")
    If (IsProcessRunning("Notepad.exe") = True) Then
        Dim sql As String
        sql = "UPDATE Stats SET Hours = Hours+10 WHERE User = '" & Username.Text & "'"
        With ADO
        .RecordSource = sql
        .Refresh<-------- Line that gives me the error

        End With
        Label2.Caption = "Running - Updated to Database."
    Else
        Label2.Caption = "Not Running"
        Timer1.Enabled = False
    End If
End Sub
I'm new.... Any help would be greatly appreciated! Thank you
Reply With Quote
  #2  
Old 05-22-2011, 04:54 AM
masterpreenx masterpreenx is offline
Newcomer
 
Join Date: Sep 2010
Location: Davao City Philippines
Posts: 24
Default

perhaps you need to open the connection before attempting to update
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
&quot;Operation is not allowed when the object is closed...&quot;
&quot;Operation is not allowed when the object is closed...&quot;
&quot;Operation is not allowed when the object is closed...&quot; &quot;Operation is not allowed when the object is closed...&quot;
&quot;Operation is not allowed when the object is closed...&quot;
&quot;Operation is not allowed when the object is closed...&quot;
&quot;Operation is not allowed when the object is closed...&quot; &quot;Operation is not allowed when the object is closed...&quot; &quot;Operation is not allowed when the object is closed...&quot; &quot;Operation is not allowed when the object is closed...&quot; &quot;Operation is not allowed when the object is closed...&quot; &quot;Operation is not allowed when the object is closed...&quot; &quot;Operation is not allowed when the object is closed...&quot;
&quot;Operation is not allowed when the object is closed...&quot;
&quot;Operation is not allowed when the object is closed...&quot;
 
&quot;Operation is not allowed when the object is closed...&quot;
&quot;Operation is not allowed when the object is closed...&quot;
 
-->