Results 1 to 7 of 7

Thread: [RESOLVED] [2008] Error system.invalidoperationexception

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2008
    Posts
    7

    Resolved [RESOLVED] [2008] Error system.invalidoperationexception

    I've made an application in VB.NET that runs without any error on the PC where .NET it's installed. But on another PC the build executable occurs an error system.invalidoperationexception
    The .NET FRAMEWORK that needs the application it's installed.

    Anyone could help me out?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2008] Error system.invalidoperationexception

    By default VB 2008 will target version 3.5 of the Framework. Does this other system have version 3.5 installed?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2008
    Posts
    7

    Re: [2008] Error system.invalidoperationexception

    Yes, it's installed.
    .NET FRAMEWORK 3.5 installed
    .NET FRAMEWORK 2.0 installed also, this one it's required for the application.

    I have tried on several PC-s the application with the Frameworks installed but the same error occured.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2008] Error system.invalidoperationexception

    Try handling the UnhandledException event of your application, which all VB.NET WinForms apps should do. Hopefully it should be able to tell you exactly what's happened.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2008
    Posts
    7

    Re: [2008] Error system.invalidoperationexception

    This is the code. If there would be any errors then it would tell me, no?
    But I don't get any error message. Just that microsoft OS error.

    vb Code:
    1. Private Sub Foprg_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         '--------------- FOPROGI -----------
    3.         On Error GoTo ide
    4.         MenuItem1.Enabled = False
    5.         MenuItem2.Enabled = False
    6.         MenuItem3.Enabled = False
    7.         MenuItem4.Enabled = False
    8.         Panel1.Location = New Point(19, 79)
    9.         Panel2.Location = New Point(19, 79)
    10.         AppPath = Application.StartupPath
    11.  
    12.         If Not adat_kiolvas(AppPath & "\path.sdf", "path") Then
    13.             Panel1.Visible = True
    14.         Else
    15.             Panel2.Visible = True
    16.         End If
    17.         Exit Sub
    18. ide:
    19.         MsgBox(Err.Number & " - " & Err.Description)
    20.     End Sub
    21.  
    22.  
    23.     Function adat_kiolvas(ByVal mit As String, ByVal melyik As String) As Boolean
    24.         conn.ConnectionString = "Persist Security Info = False; " & _
    25.             "Data Source = '" & mit & "';"
    26.         conn.Open()
    27.         rec.Connection = conn
    28.         rec.CommandType = System.Data.CommandType.Text
    29.         rec.CommandText = ("select * from " & melyik)
    30.         Try
    31.             recr = rec.ExecuteReader()
    32.             While recr.Read
    33.                 If recr(0) <> "" Then
    34.                     path = recr(0)
    35.                     adat_kiolvas = True
    36.                 End If
    37.             End While
    38.             Return True
    39.         Catch ex As Exception
    40.             MessageBox.Show(ex.Message)
    41.             Return False
    42.         End Try
    43.         conn.Close()
    44.         Exit Function
    45.  
    46.     End Function

  6. #6

    Thread Starter
    New Member
    Join Date
    Aug 2008
    Posts
    7

    Re: [2008] Error system.invalidoperationexception

    It seems that I have found the problem. I used SqlCeConnection instead of SqlConnection. Anyway it's an app for a WinCE OS and i tried to write the app to run on WIN OS too.
    Now i will have to rewrite the whole code to connect/write/read to/from database.

  7. #7

    Thread Starter
    New Member
    Join Date
    Aug 2008
    Posts
    7

    Re: [2008] Error system.invalidoperationexception

    I have found a solution to to connect/write/read to/from .sdf database on desktop PC with SqlCe using Microsoft SQL Server 2005 Compact Edition 3.1 or 3.5 and Microsoft .NET Framework 3.5.
    It's very simple.
    Download the Microsoft SQL Server 2005 Compact Edition 3.1 from here http://www.microsoft.com/downloads/d...displaylang=en, install it on your PC where you develope your app. Add reference to the System.Data.SqlServerCe.dll
    Default path: C:\Program Files\Microsoft SQL Server Compact Edition\v3.1\

    On the PC that you wanna use the app you copy with the app the dll's from the installed Microsoft SQL Server 2005 Compact Edition 3.1 directory.

    sqlceca30.dll
    sqlcecompact30.dll
    sqlceer30EN.dll
    sqlceme30.dll
    sqlceoledb30.dll
    sqlceqp30.dll
    sqlcese30.dll
    System.Data.SqlServerCe.dll

    Install the Microsoft .NET Framework 3.5 on that PC and that's it. Your app it's working. http://www.microsoft.com/downloads/d...displaylang=en

    It's a very easy way for those who developing app's for Mobile devices and they want to run there apps on desktop pc's too.

Posting Permissions

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



Click Here to Expand Forum to Full Width