Hi,
Does any one knows why this portion of code will generate the following error,
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.
When the following code line is executed?
objcommand.Connection.Open()
Code….
-------------------------------------------------------------------------------
Dim strsql As String
Dim strconn As String
Dim objcommand As SqlClient.SqlCommand
Dim objDR As SqlClient.SqlDataReader
Dim strresult As String
strconn = "Initial Catalog=Soutiens;Data Source=CBCINC-SERVER;User ID=administrator;password=;"
strsql = "select * from project"
objcommand = New SqlClient.SqlCommand(strsql, New SqlClient.SqlConnection(strconn))
objcommand.Connection.Open()
objDR = objcommand.ExecuteReader(CommandBehavior.CloseConnection)
With objDR
Do While .Read = True
strresult = .GetString(1)
Console.WriteLine(strresult)
Loop
.Close()
End With
Thanks in advance....
Carl Barbeau.
Analyst Designer office systems.
Carl Barbeau consultant Inc.