Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with Imports and SqlConnection
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Problem with Imports and SqlConnection
Divers
Thread ID:
00707445
Message ID:
00707445
Vues:
74
I have run into a problem using Visual Studio.NET and a code-behind page. I am reading a couple of ASP.NET books, and all the examples have the code in the .aspx page. It's my understanding that it's better to put the code in the code behind page. Is that correct?

In my code-behind page, I have:
Imports System.Data
Imports System.Data.SqlClient

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  'Put user code to initialize the page here

  Dim conStockIndex As SqlConnection

  conStockIndex = New SqlConnection("connection string here")
End Sub
When I do this, Visual Studio.NET gives me an error:

Too many arguments to Public Sub New()

If I add System.Data.SqlClient to the Dim and New statements, everything works fine. Can someone tell my why I have to explicitly reference System.Data.SqlClient?
Chris McCandless
Red Sky Software
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform