Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADO.net and VB.NET connection errors
Message
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
ADO.net and VB.NET connection errors
Miscellaneous
Thread ID:
00616414
Message ID:
00616414
Views:
60
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.
Next
Reply
Map
View

Click here to load this message in the networking platform