Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADO.net and VB.NET connection errors
Message
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
ADO.net and VB.NET connection errors
Divers
Thread ID:
00616414
Message ID:
00616414
Vues:
61
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform