473,703 Members | 4,141 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Running both in the IDE and on a remote host

I have an ASP.NET web page accessing a SQL database. I've used VS to build
the app and stored it in the eNPTest02 directory of my localhost on my
development machine. The database is on the web. I've found a way that
works on the web, and I'm trying to get it to also work in debug mode in the
IDE. The "on the web" page and my SQL database are hosted by a third party
(on separate servers).

Since debug mode opens IE and loads my page from localhost, since the
database is located at a web URL, and since my development machine has an
always-on DSL connection, I'm hoping there's a way to get this to work.

As far as I can tell, this may be a Page directive issue: src vs codebehind.
But in either case, I can't get this to work in the IDE.

What am I doing wrong?? I'd appreciate your help.

I've tried 4 Page directive variations, differing in how I reference the vb
page and how I inherit the class:

<%@ Page Language="vb" codebehind="eNP 02.aspx.vb" autoeventwireup ="false"
Inherits="eNPTe st02.WebForm1"% >
<%@ Page Language="vb" codebehind="eNP 02.aspx.vb" autoeventwireup ="false"
Inherits="WebFo rm1"%>
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="eNPTe st02.WebForm1"% >
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="WebFo rm1"%>

None of the above runs in debug mode in the IDE. The last one runs
successfully on the remote host.

codebehind: Won't run in IDE
Won't run on remote host (Parser Error Message: Could not load type)
IDE views are fine

src: Won't run in IDE
Runs on remote host (if I don't refer to localhost directory - as I'd
expect)
Cannot access form design view in IDE
In more detail, here's what happens with each of the 4 variations (Detailed
Code is provided at the end of this post):

'**********
<%@ Page Language="vb" codebehind="eNP 02.aspx.vb" autoeventwireup ="false"
Inherits="eNPTe st02.WebForm1"% >

Run in IDE (debug mode)
IE opens, loads eNP02.aspx from localhost, and hangs. (Eventually I get a
page cannot be displayed error.) When I step through the

code, the Page_Load event code executes without throwing an exception.

Run on remote host
Parser Error Message: Could not load type 'eNPTest02.WebF orm1'.

When I open the project after it's been closed
The Design and HTML views of eNP02.aspx both display fine.
'**********
<%@ Page Language="vb" codebehind="eNP 02.aspx.vb" autoeventwireup ="false"
Inherits="WebFo rm1"%>

Run in IDE (debug mode)
Parser Error Message: Could not load type 'WebForm1'.

Run on remote host
Parser Error Message: Could not load type 'WebForm1'.

When I open the project after it's been closed
The Design and HTML views of eNP02.aspx both display fine.
'**********
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="eNPTe st02.WebForm1"% >

Run in IDE (debug mode)
Parser Error Message: The base type 'eNPTest02.WebF orm1' does not exist in
the source file 'eNP02.aspx.vb' .

Run on remote host
Parser Error Message: The base type 'eNPTest02.WebF orm1' does not exist in
the source file 'eNP02.aspx.vb' .

When I open the project after it's been closed
The file could not be loaded into the Web Forms designer. Please correct
the following error and then try loading it again: The @

Page or @ Control directive contains a src= attribute, which is not
supported in Visual Studio. Make sure all of the classes used in this

page are built or referenced in the project.

I can load the HTML view of eNP02.aspx, but I cannot access the Design view
'**********
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="WebFo rm1"%>

Run in IDE (debug mode)
IE opens, loads eNP02.aspx from localhost, and hangs. (Eventually I get a
page cannot be displayed error.) When I step through the

code, the Page_Load event code executes without throwing an exception.

Run on remote host
Runs successfully. The database connection succeeds, and the datagrid
displays all data.

When I open the project after it's been closed
The file could not be loaded into the Web Forms designer. Please correct
the following error and then try loading it again: The @

Page or @ Control directive contains a src= attribute, which is not
supported in Visual Studio. Make sure all of the classes used in this

page are built or referenced in the project.

I can load the HTML view of eNP02.aspx, but I cannot access the Design
view.
codebehind: Won't run on localhost
Won't run on remote host (Parser Error Message: Could not load type)
IDE views are fine

src: Won't run on localhost
Runs on remote host (if I don't refer to localhost directory - as I'd
expect)
Cannot access form design view in IDE
Code:

'eNP02.aspx - the form:
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="WebFo rm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>

<HEAD>
<title>WebForm1 </title>
<meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>

<body MS_POSITIONING= "GridLayout ">
<TABLE height="310" cellSpacing="0" cellPadding="0" width="359"
border="0" ms_2d_layout="T RUE">
<TR vAlign="top">
<TD width="359" height="310">
<form id="Form1" method="post" runat="server">
<TABLE height="342" cellSpacing="0" cellPadding="0" width="298"
border="0" ms_2d_layout="T RUE">
<TR vAlign="top">
<TD width="56" height="80"></TD>
<TD width="8"></TD>
<TD width="234"></TD>
</TR>
<TR vAlign="top">
<TD height="128"></TD>
<TD colSpan="2">
<asp:Label id="Label1" runat="server" Width="240px"
Height="96px" BorderStyle="So lid">Test 01 Label</asp:Label></TD>
</TR>
<TR vAlign="top">
<TD colSpan="2" height="134"></TD>
<TD>
<asp:DataGrid id="dgCustomers "
runat="server"> </asp:DataGrid></TD>
</TR>
</TABLE>
</form>
</TD>
</TR>
</TABLE>
</body>

</HTML>
'eNP02.aspx.vb - the codebehind file
Imports System
Imports System.Web.UI
Imports System.Web.UI.W ebControls
Imports System.Web.UI.H tmlControls
Imports System.Data.Sql Client

Public Class WebForm1
Inherits System.Web.UI.P age

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

End Sub
Protected WithEvents Label1 As System.Web.UI.W ebControls.Labe l
Protected WithEvents dgCustomers As System.Web.UI.W ebControls.Data Grid

'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
Dim conMain As SqlConnection
Dim sqlCmd As SqlCommand
Dim strConn As String

Try

strConn = ""
strConn = strConn & "Network Library=dbmssoc n;"
strConn = strConn & "Password=myPas sword;"
strConn = strConn & "User ID=myUser;"
strConn = strConn & "Initial Catalog=myDB;"
strConn = strConn & "Data Source=000.000. 000.000;"

conMain = New SqlConnection(s trConn)
sqlCmd = New SqlCommand("SEL ECT FirstName, LastName FROM
eNPCustomers", conMain)
conMain.Open()

Dim rdrCustomers As SqlDataReader = sqlCmd.ExecuteR eader

dgCustomers.Dat aSource = rdrCustomers
dgCustomers.Dat aBind()

conMain.Close()

Label1.Text = "Codebehind Works"

Catch ex As Exception
Response.Write( ex.ToString)

End Try

End Sub

End Class
Nov 19 '05 #1
2 2190
Hi Jeff,

I would start over with a new page. In VS.Net create a new web page, call
it eNP03.Aspx when it asks for a name. Now your code behind and your .aspx
page will be properly hooked up. Next copy everything but the @Page
directive in eNP02, paste this into eNP03 overwriting everything but the
@Page directive. Next copy all the code from the eNP02.aspx.vb file and
paste it into eNP03.aspx.vb. Then change this line:

Public Class WebForm1

Back to:

Public Class eNP03

Which is what it was before you copied the code in the .vb file. Now you
know you are setup right. Set eNP03.aspx as your start page by right
clicking on it and selecting that menu item. Now run the project. If you
still have a problem then you probably have something setup wrong with your
IIS or .Net Framework setup. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Jeff" <je*********@eN etPortals.com> wrote in message
news:sI******** ********@newsre ad3.news.atl.ea rthlink.net...
I have an ASP.NET web page accessing a SQL database. I've used VS to build the app and stored it in the eNPTest02 directory of my localhost on my
development machine. The database is on the web. I've found a way that
works on the web, and I'm trying to get it to also work in debug mode in the IDE. The "on the web" page and my SQL database are hosted by a third party (on separate servers).

Since debug mode opens IE and loads my page from localhost, since the
database is located at a web URL, and since my development machine has an
always-on DSL connection, I'm hoping there's a way to get this to work.

As far as I can tell, this may be a Page directive issue: src vs codebehind. But in either case, I can't get this to work in the IDE.

What am I doing wrong?? I'd appreciate your help.

I've tried 4 Page directive variations, differing in how I reference the v b page and how I inherit the class:

<%@ Page Language="vb" codebehind="eNP 02.aspx.vb" autoeventwireup ="false"
Inherits="eNPTe st02.WebForm1"% >
<%@ Page Language="vb" codebehind="eNP 02.aspx.vb" autoeventwireup ="false"
Inherits="WebFo rm1"%>
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="eNPTe st02.WebForm1"% >
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="WebFo rm1"%>

None of the above runs in debug mode in the IDE. The last one runs
successfully on the remote host.

codebehind: Won't run in IDE
Won't run on remote host (Parser Error Message: Could not load type)
IDE views are fine

src: Won't run in IDE
Runs on remote host (if I don't refer to localhost directory - as I'd
expect)
Cannot access form design view in IDE
In more detail, here's what happens with each of the 4 variations (Detailed Code is provided at the end of this post):

'**********
<%@ Page Language="vb" codebehind="eNP 02.aspx.vb" autoeventwireup ="false"
Inherits="eNPTe st02.WebForm1"% >

Run in IDE (debug mode)
IE opens, loads eNP02.aspx from localhost, and hangs. (Eventually I get a page cannot be displayed error.) When I step through the

code, the Page_Load event code executes without throwing an exception.

Run on remote host
Parser Error Message: Could not load type 'eNPTest02.WebF orm1'.

When I open the project after it's been closed
The Design and HTML views of eNP02.aspx both display fine.
'**********
<%@ Page Language="vb" codebehind="eNP 02.aspx.vb" autoeventwireup ="false"
Inherits="WebFo rm1"%>

Run in IDE (debug mode)
Parser Error Message: Could not load type 'WebForm1'.

Run on remote host
Parser Error Message: Could not load type 'WebForm1'.

When I open the project after it's been closed
The Design and HTML views of eNP02.aspx both display fine.
'**********
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="eNPTe st02.WebForm1"% >

Run in IDE (debug mode)
Parser Error Message: The base type 'eNPTest02.WebF orm1' does not exist in the source file 'eNP02.aspx.vb' .

Run on remote host
Parser Error Message: The base type 'eNPTest02.WebF orm1' does not exist in the source file 'eNP02.aspx.vb' .

When I open the project after it's been closed
The file could not be loaded into the Web Forms designer. Please correct
the following error and then try loading it again: The @

Page or @ Control directive contains a src= attribute, which is not
supported in Visual Studio. Make sure all of the classes used in this

page are built or referenced in the project.

I can load the HTML view of eNP02.aspx, but I cannot access the Design view

'**********
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="WebFo rm1"%>

Run in IDE (debug mode)
IE opens, loads eNP02.aspx from localhost, and hangs. (Eventually I get a page cannot be displayed error.) When I step through the

code, the Page_Load event code executes without throwing an exception.

Run on remote host
Runs successfully. The database connection succeeds, and the datagrid
displays all data.

When I open the project after it's been closed
The file could not be loaded into the Web Forms designer. Please correct
the following error and then try loading it again: The @

Page or @ Control directive contains a src= attribute, which is not
supported in Visual Studio. Make sure all of the classes used in this

page are built or referenced in the project.

I can load the HTML view of eNP02.aspx, but I cannot access the Design
view.
codebehind: Won't run on localhost
Won't run on remote host (Parser Error Message: Could not load type)
IDE views are fine

src: Won't run on localhost
Runs on remote host (if I don't refer to localhost directory - as I'd
expect)
Cannot access form design view in IDE
Code:

'eNP02.aspx - the form:
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="WebFo rm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>

<HEAD>
<title>WebForm1 </title>
<meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>

<body MS_POSITIONING= "GridLayout ">
<TABLE height="310" cellSpacing="0" cellPadding="0" width="359"
border="0" ms_2d_layout="T RUE">
<TR vAlign="top">
<TD width="359" height="310">
<form id="Form1" method="post" runat="server">
<TABLE height="342" cellSpacing="0" cellPadding="0" width="298" border="0" ms_2d_layout="T RUE">
<TR vAlign="top">
<TD width="56" height="80"></TD>
<TD width="8"></TD>
<TD width="234"></TD>
</TR>
<TR vAlign="top">
<TD height="128"></TD>
<TD colSpan="2">
<asp:Label id="Label1" runat="server" Width="240px"
Height="96px" BorderStyle="So lid">Test 01 Label</asp:Label></TD>
</TR>
<TR vAlign="top">
<TD colSpan="2" height="134"></TD>
<TD>
<asp:DataGrid id="dgCustomers "
runat="server"> </asp:DataGrid></TD>
</TR>
</TABLE>
</form>
</TD>
</TR>
</TABLE>
</body>

</HTML>
'eNP02.aspx.vb - the codebehind file
Imports System
Imports System.Web.UI
Imports System.Web.UI.W ebControls
Imports System.Web.UI.H tmlControls
Imports System.Data.Sql Client

Public Class WebForm1
Inherits System.Web.UI.P age

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

End Sub
Protected WithEvents Label1 As System.Web.UI.W ebControls.Labe l
Protected WithEvents dgCustomers As System.Web.UI.W ebControls.Data Grid

'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
Dim conMain As SqlConnection
Dim sqlCmd As SqlCommand
Dim strConn As String

Try

strConn = ""
strConn = strConn & "Network Library=dbmssoc n;"
strConn = strConn & "Password=myPas sword;"
strConn = strConn & "User ID=myUser;"
strConn = strConn & "Initial Catalog=myDB;"
strConn = strConn & "Data Source=000.000. 000.000;"

conMain = New SqlConnection(s trConn)
sqlCmd = New SqlCommand("SEL ECT FirstName, LastName FROM
eNPCustomers", conMain)
conMain.Open()

Dim rdrCustomers As SqlDataReader = sqlCmd.ExecuteR eader

dgCustomers.Dat aSource = rdrCustomers
dgCustomers.Dat aBind()

conMain.Close()

Label1.Text = "Codebehind Works"

Catch ex As Exception
Response.Write( ex.ToString)

End Try

End Sub

End Class

Nov 19 '05 #2
Thanks Ken -

I tried your suggestion with the same result. And while there may be
something amiss with IIS, I don't think that's causing this problem(?).

I've tested the aspx - vb page link and it seems to be working. I think
I've narrowd the problem down to something having to do with databinding.

So once again, I've posted a new thread (Databinding a SQLDataReader to a
DataGrid control), since the 'Subject' no longer applies. I'd appreciate
any further suggestions you can offer.

- Jeff
"Ken Dopierala Jr." <kd*********@wi .rr.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi Jeff,

I would start over with a new page. In VS.Net create a new web page, call
it eNP03.Aspx when it asks for a name. Now your code behind and your ..aspx page will be properly hooked up. Next copy everything but the @Page
directive in eNP02, paste this into eNP03 overwriting everything but the
@Page directive. Next copy all the code from the eNP02.aspx.vb file and
paste it into eNP03.aspx.vb. Then change this line:

Public Class WebForm1

Back to:

Public Class eNP03

Which is what it was before you copied the code in the .vb file. Now you
know you are setup right. Set eNP03.aspx as your start page by right
clicking on it and selecting that menu item. Now run the project. If you
still have a problem then you probably have something setup wrong with your IIS or .Net Framework setup. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Jeff" <je*********@eN etPortals.com> wrote in message
news:sI******** ********@newsre ad3.news.atl.ea rthlink.net...
I have an ASP.NET web page accessing a SQL database. I've used VS to build
the app and stored it in the eNPTest02 directory of my localhost on my
development machine. The database is on the web. I've found a way that
works on the web, and I'm trying to get it to also work in debug mode in

the
IDE. The "on the web" page and my SQL database are hosted by a third

party
(on separate servers).

Since debug mode opens IE and loads my page from localhost, since the
database is located at a web URL, and since my development machine has an always-on DSL connection, I'm hoping there's a way to get this to work.

As far as I can tell, this may be a Page directive issue: src vs

codebehind.
But in either case, I can't get this to work in the IDE.

What am I doing wrong?? I'd appreciate your help.

I've tried 4 Page directive variations, differing in how I reference the v b
page and how I inherit the class:

<%@ Page Language="vb" codebehind="eNP 02.aspx.vb"
autoeventwireup ="false" Inherits="eNPTe st02.WebForm1"% >
<%@ Page Language="vb" codebehind="eNP 02.aspx.vb" autoeventwireup ="false" Inherits="WebFo rm1"%>
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="eNPTe st02.WebForm1"% >
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="WebFo rm1"%>

None of the above runs in debug mode in the IDE. The last one runs
successfully on the remote host.

codebehind: Won't run in IDE
Won't run on remote host (Parser Error Message: Could not load type)
IDE views are fine

src: Won't run in IDE
Runs on remote host (if I don't refer to localhost directory - as I'd
expect)
Cannot access form design view in IDE
In more detail, here's what happens with each of the 4 variations

(Detailed
Code is provided at the end of this post):

'**********
<%@ Page Language="vb" codebehind="eNP 02.aspx.vb" autoeventwireup ="false" Inherits="eNPTe st02.WebForm1"% >

Run in IDE (debug mode)
IE opens, loads eNP02.aspx from localhost, and hangs. (Eventually I get a
page cannot be displayed error.) When I step through the

code, the Page_Load event code executes without throwing an exception.

Run on remote host
Parser Error Message: Could not load type 'eNPTest02.WebF orm1'.

When I open the project after it's been closed
The Design and HTML views of eNP02.aspx both display fine.
'**********
<%@ Page Language="vb" codebehind="eNP 02.aspx.vb"
autoeventwireup ="false" Inherits="WebFo rm1"%>

Run in IDE (debug mode)
Parser Error Message: Could not load type 'WebForm1'.

Run on remote host
Parser Error Message: Could not load type 'WebForm1'.

When I open the project after it's been closed
The Design and HTML views of eNP02.aspx both display fine.
'**********
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="eNPTe st02.WebForm1"% >

Run in IDE (debug mode)
Parser Error Message: The base type 'eNPTest02.WebF orm1' does not exist

in
the source file 'eNP02.aspx.vb' .

Run on remote host
Parser Error Message: The base type 'eNPTest02.WebF orm1' does not exist

in
the source file 'eNP02.aspx.vb' .

When I open the project after it's been closed
The file could not be loaded into the Web Forms designer. Please correct the following error and then try loading it again: The @

Page or @ Control directive contains a src= attribute, which is not
supported in Visual Studio. Make sure all of the classes used in this

page are built or referenced in the project.

I can load the HTML view of eNP02.aspx, but I cannot access the Design

view


'**********
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="WebFo rm1"%>

Run in IDE (debug mode)
IE opens, loads eNP02.aspx from localhost, and hangs. (Eventually I get a
page cannot be displayed error.) When I step through the

code, the Page_Load event code executes without throwing an exception.

Run on remote host
Runs successfully. The database connection succeeds, and the datagrid
displays all data.

When I open the project after it's been closed
The file could not be loaded into the Web Forms designer. Please

correct the following error and then try loading it again: The @

Page or @ Control directive contains a src= attribute, which is not
supported in Visual Studio. Make sure all of the classes used in this

page are built or referenced in the project.

I can load the HTML view of eNP02.aspx, but I cannot access the Design
view.
codebehind: Won't run on localhost
Won't run on remote host (Parser Error Message: Could not load type)
IDE views are fine

src: Won't run on localhost
Runs on remote host (if I don't refer to localhost directory - as I'd
expect)
Cannot access form design view in IDE
Code:

'eNP02.aspx - the form:
<%@ Page Language="vb" src="eNP02.aspx .vb" autoeventwireup ="false"
Inherits="WebFo rm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>

<HEAD>
<title>WebForm1 </title>
<meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>

<body MS_POSITIONING= "GridLayout ">
<TABLE height="310" cellSpacing="0" cellPadding="0" width="359"
border="0" ms_2d_layout="T RUE">
<TR vAlign="top">
<TD width="359" height="310">
<form id="Form1" method="post" runat="server">
<TABLE height="342" cellSpacing="0" cellPadding="0"

width="298"
border="0" ms_2d_layout="T RUE">
<TR vAlign="top">
<TD width="56" height="80"></TD>
<TD width="8"></TD>
<TD width="234"></TD>
</TR>
<TR vAlign="top">
<TD height="128"></TD>
<TD colSpan="2">
<asp:Label id="Label1" runat="server" Width="240px"
Height="96px" BorderStyle="So lid">Test 01 Label</asp:Label></TD>
</TR>
<TR vAlign="top">
<TD colSpan="2" height="134"></TD>
<TD>
<asp:DataGrid id="dgCustomers "
runat="server"> </asp:DataGrid></TD>
</TR>
</TABLE>
</form>
</TD>
</TR>
</TABLE>
</body>

</HTML>
'eNP02.aspx.vb - the codebehind file
Imports System
Imports System.Web.UI
Imports System.Web.UI.W ebControls
Imports System.Web.UI.H tmlControls
Imports System.Data.Sql Client

Public Class WebForm1
Inherits System.Web.UI.P age

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

End Sub
Protected WithEvents Label1 As System.Web.UI.W ebControls.Labe l
Protected WithEvents dgCustomers As System.Web.UI.W ebControls.Data Grid

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
Dim conMain As SqlConnection
Dim sqlCmd As SqlCommand
Dim strConn As String

Try

strConn = ""
strConn = strConn & "Network Library=dbmssoc n;"
strConn = strConn & "Password=myPas sword;"
strConn = strConn & "User ID=myUser;"
strConn = strConn & "Initial Catalog=myDB;"
strConn = strConn & "Data Source=000.000. 000.000;"

conMain = New SqlConnection(s trConn)
sqlCmd = New SqlCommand("SEL ECT FirstName, LastName FROM
eNPCustomers", conMain)
conMain.Open()

Dim rdrCustomers As SqlDataReader = sqlCmd.ExecuteR eader

dgCustomers.Dat aSource = rdrCustomers
dgCustomers.Dat aBind()

conMain.Close()

Label1.Text = "Codebehind Works"

Catch ex As Exception
Response.Write( ex.ToString)

End Try

End Sub

End Class


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2147
by: faktujaa | last post by:
Hi, I have created an application that uses IIS to host remote components. All the remote components are listed in app.config in client and web.config in server. Now the app.config can contain either localhost name/IP address to point to remote component like <wellknown type="XYZ, XYZ" url="http://localhost:80/XYZ" />. Remoting configuration is done using RemotingConfiguration.Configure("XYZ.exe.config") in application's main method....
0
1534
by: Christopher Attard | last post by:
Hi, I'm using the PerformanceCounter .NET class to obtain the "% Processor Time" for processes that are running on a remote host. These processes are obtained using the System.Diagnostics.Process.GetProcesses(host) method. I'm noticing that for some running processes, the program is throwing out an exception "Cannot read instance :<processname>". Is this a known issue or could it be solved? For e.g. on getting "% Processor Time"...
0
1698
by: Johann Blake | last post by:
I am using the TcpClient to connect to a web site. I then open a NetworkStream and read the contents that are being sent back. The problem is that I have no idea when the remote host is finished sending data. It is sending a web page but it doesn't use the Content-Length header to indicate the size. While I can use the DataAvailable property, it is well known that you cannot rely on this to know when no more data is available. What I...
3
2492
by: Fredric Ragnar | last post by:
Hi, I am making a prototype system with Remoting in the bottom of the system. An XML Web Service is using the remote object on an IIS to present data. I am using a TcpChannel for communicating between the XML Web Service and the host for the remote object. Within the host a port is defined and the channel registered. It starts listening for requests. The destination port is therefore clearly defined.
4
3889
by: cpptutor2000 | last post by:
Could some C guru help me please? I am using the following program to open a SSH connection to a remote host and eventually run a program on that remote host. #include <stdio.h> #include <stdlib.h> int main(int argc, char* argv){ char command;
3
2598
by: Michel | last post by:
Hi, I wrote an app in .Net and I whant only 1 instance of this app open for the user; the user open my app, do some works and try to open another instance of my app, I whant to show a message to user to inform him that only one instance is permit and then close the second instance after that. I am able to do this when the user run the application on his PC whit this : Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName) ...
7
2589
by: | last post by:
I'm writing an ASP.NET app, using Visual Studio 2003. VS is running locally on my laptop, but the web app is running on a remote server. My laptop is not in the domain. I do have a domain account. I had no issue creating the web app on the remote server after authenticating with the domain account, but I can't debug. It complains that I don't have rights. My domain account is in the administrators group on the remote machine. I also have...
3
3701
by: alex | last post by:
Hello, My script is trying to get a file from a remote server, every day it ftps from a directory. My code works perfect if I know the name of the file in the remote directory. ftp.retrbinary('RETR ' + filename, handleDownload) The problem is that in the future the name of the file is going to be aleatory. How can I get the file's name (only one file is in that
0
2587
by: sillz | last post by:
On Apr 8, 2:00 pm, sillz <beth.sto...@gmail.comwrote: I never could get this to work. The oracle account tested fine. I ended up creating a new account in Windows with the right permissions and this solved the problem.
0
8761
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8672
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5923
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4434
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2462
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2070
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.