[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.
http://www.vbforums.com/
Anyone could help me out?
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?
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.
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.
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:
Private Sub Foprg_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'--------------- FOPROGI -----------
On Error GoTo ide
MenuItem1.Enabled = False
MenuItem2.Enabled = False
MenuItem3.Enabled = False
MenuItem4.Enabled = False
Panel1.Location = New Point(19, 79)
Panel2.Location = New Point(19, 79)
AppPath = Application.StartupPath
If Not adat_kiolvas(AppPath & "\path.sdf", "path") Then
Panel1.Visible = True
Else
Panel2.Visible = True
End If
Exit Sub
ide:
MsgBox(Err.Number & " - " & Err.Description)
End Sub
Function adat_kiolvas(ByVal mit As String, ByVal melyik As String) As Boolean
conn.ConnectionString = "Persist Security Info = False; " & _
"Data Source = '" & mit & "';"
conn.Open()
rec.Connection = conn
rec.CommandType = System.Data.CommandType.Text
rec.CommandText = ("select * from " & melyik)
Try
recr = rec.ExecuteReader()
While recr.Read
If recr(0) <> "" Then
path = recr(0)
adat_kiolvas = True
End If
End While
Return True
Catch ex As Exception
MessageBox.Show(ex.Message)
Return False
End Try
conn.Close()
Exit Function
End Function
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.
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.