473,545 Members | 1,638 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 2182
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
2114
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...
0
1526
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...
0
1683
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...
3
2487
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...
4
3881
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
2567
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...
7
2578
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...
3
3694
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...
0
2572
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
7459
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...
0
7393
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...
0
7653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7411
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...
0
7749
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5322
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4942
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...
0
3444
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...
1
1012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.