No result of code in Visual Studio.Net

Damdile

New Member
This is weird !!!<BR><BR>This is an example of Beginning ASP.NET 1.0 with VB.NET which works fine when I type it in Notepad, but doesn't work when I type it in VS.NET and then build the project. Does anybody know why this is ?!<BR><BR><%@ Import Namespace="System.Data" %><BR><%@ Import Namespace="System.Data.OleDb" %><BR><BR><script language="VB" runat="server"><BR><BR> Sub Page_Load(Sender As Object, E As EventArgs)<BR><BR> Dim objConnection As OleDbConnection<BR> Dim objCmd As OleDbCommand<BR> Dim strConnection As String<BR> <BR> strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _<BR> "Data Source=C:Beginning ASP.NETNorthwind.mdb"<BR><BR> <BR> ' Create and open the connection object<BR> objConnection = New OleDbConnection(strConnection)<BR> objConnection.Open()<BR> <BR> ' Create the Command and set its properties<BR> objCmd = New OleDbCommand()<BR> objCmd.Connection = objConnection<BR> objCmd.CommandText = "[Sales by Category]"<BR> objCmd.CommandType = CommandType.StoredProcedure<BR><BR> dgSales.DataSource = objCmd.ExecuteReader(CommandBehavior.CloseConnecti on)<BR> dgSales.DataBind()<BR><BR> End Sub<BR><BR></script><BR><BR><html><BR> <body><BR> <h2>Using a stored procedure</h2><BR> <asp:datagrid id="dgSales" runat="server" /><BR> </body><BR></html>Is it possible that I have to declare the database somewhere in my project to make it work ?!Never mind, it was (of course) my own dumb fault that it didn't work.<BR><BR>Pfffff, I still gotta get used to .NET, but hey, who doesn't ?!
 
Back
Top