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
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