Database connection
Hi Everyone,
I am desperate and need assistance, which I would appreciate very much.
I have the following code, which return the message:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll, and when I place the cursor on the highlighted green section I find this:
This code has called into another function. When that function is finished, this is the next statement that will be executed.
The code is:
<Private Sub ProjectFeed_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ProjectConnectionString As String = "Persist Security Info=False;Integrated Security=SSPI;database=Project;server=mySQLServer"
Dim ProjectConnection As New SqlConnection(ProjectconnectionString)
Dim ProjectCommand As SqlCommand = New SqlCommand
ProjectCommand.Connection = ProjectConnection
ProjectCommand.CommandText = "Insert into projects " & "(Project No,Client,Rate Type,Description,Starting date,Ending date, Location,Status,Comment,Manager)" & _
"values(@project No,@client,@Rate Type,@description,@starting date,@ending date, location,@status,@Comment,@Manager)"
ProjectCommand.Parameters.Add("Project No", txtProjectNo.Text)
ProjectCommand.Parameters.Add("Client", txtClient.Text)
ProjectCommand.Parameters.Add("Rate Type", cmbRate.Text)
ProjectCommand.Parameters.Add("Starting date", txtStart.Text)
ProjectCommand.Parameters.Add("Location", txtLocation.Text)
ProjectCommand.Parameters.Add("Status", cmbStatus.Text)
ProjectCommand.Parameters.Add("Comment", txtComments.Text)
ProjectCommand.Parameters.Add("Manager", txtManager.Text)
ProjectConnection.Open()
ProjectCommand.ExecuteNonQuery()
ProjectConnection.Close()
End Sub/>
Can someone please help.
Thanks
Khalil
|