Basics: VB.net, Windows 2000 and XP, .Net Framework 1.1, MS SQL Server 7.
I have written a simple vb.net application (Test1.exe) that reads a table in MS SQL Server 7 and displays a record each time the Start button is clicked. The application runs fine on my development computer. When I copy it to a mapped network drive it also runs fine if I execute it from my development computer. Additonally, it runs fine from other people's computers - both from their C: drive and from the mapped network drive.
However, we recently added some new computers for some users and when they try to run the application from their C: drive or from the mapped network drive, they get the following error: "Test1.exe - Common Language Runtime Debugging Services. Application has generated an exception that could not be handled." No other helpful information is displayed. All the computers including the new ones are running .NET Framework 1.1.
This error message is similar to an error I was getting a while back. See
http://www-tcsn.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20665455.html At the time I thought the solution offered would solve the problems, but we are still getting an error.
It appears that the problem may be somehow related to my adding the SQL code to the program that reads the SQL table and displays the records - but I am not sure about that. I did test this theory as follows: I created a really simple vb.net program that just displays "Hello" in a label when a button is pressed. There was no SQL Server commands in this first program. The program ran just fine from everyone's computers including the new users's computers and the mapped drives. Then I added the SQL Server commands shown below and although the program runs fine from my development computer and the mapped drive and the older users's computers, it did not run from the newer users computers. So it looks like there may be an issue with SQL rights?
Below is the code from the program (Test1.exe) that contains the SQL Server commands and causes the error message:
==========================
==========
==========
==========
==========
==========
=
Imports System.Data.SqlClient
Public Class Form1
Inherits System.Windows.Forms.Form
Dim mDataReader As SqlDataReader
Dim mSqlConnection As SqlConnection = New SqlConnection("Data Source=SV03;Integrated Security=SSPI;Initial Catalog=HF_Standards; ")
Dim mSqlCommand As New SqlCommand("Select * from Divisions Order By Sort_Seq, Division", mSqlConnection)
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
mSqlConnection.Open()
mDataReader = mSqlCommand.ExecuteReader
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon
tainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Butto
n
Friend WithEvents Button2 As System.Windows.Forms.Butto
n
Friend WithEvents Label1 As System.Windows.Forms.Label
<System.Diagnostics.Debugg
erStepThro
ugh()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Butto
n
Me.Button2 = New System.Windows.Forms.Butto
n
Me.Label1 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(48, 140)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(80, 24)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Start"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(168, 140)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(72, 24)
Me.Button2.TabIndex = 1
Me.Button2.Text = "Exit"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(36, 48)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(216, 24)
Me.Label1.TabIndex = 2
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 201)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Button2
)
Me.Controls.Add(Me.Button1
)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
mDataReader.Read()
Label1.Text = mDataReader("Division")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
mDataReader.Close()
mSqlConnection.Close()
Close()
End Sub
End Class
==========================
==========
==========
==========
==========
==========
=
I am really at a loss as to how to try to solve this ongoing problem. It is becoming a real issue here.
Also note that I have done the following two things but neither worked:
1. I ran the "Microsoft .NET Framework 1.1 Configuration" utility and created a new code group for this program. I gave it unlimited rights to "Everything" including SQL Server.
2. I also ran the "Microsoft .NET Framework 1.1 Wizards" and granted full rights in "Adjust .NET Security" and "Trust an Assembly".
Neither of these made any difference.
Would appreciate any help. Thanks.