472,354 Members | 2,150 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

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="eNP02.aspx.vb" autoeventwireup="false"
Inherits="eNPTest02.WebForm1"%>
<%@ Page Language="vb" codebehind="eNP02.aspx.vb" autoeventwireup="false"
Inherits="WebForm1"%>
<%@ Page Language="vb" src="eNP02.aspx.vb" autoeventwireup="false"
Inherits="eNPTest02.WebForm1"%>
<%@ Page Language="vb" src="eNP02.aspx.vb" autoeventwireup="false"
Inherits="WebForm1"%>

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="eNP02.aspx.vb" autoeventwireup="false"
Inherits="eNPTest02.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.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" codebehind="eNP02.aspx.vb" autoeventwireup="false"
Inherits="WebForm1"%>

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="eNPTest02.WebForm1"%>

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

Run on remote host
Parser Error Message: The base type 'eNPTest02.WebForm1' 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="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
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="WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>

<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>

<body MS_POSITIONING="GridLayout">
<TABLE height="310" cellSpacing="0" cellPadding="0" width="359"
border="0" ms_2d_layout="TRUE">
<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="TRUE">
<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="Solid">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.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data.SqlClient

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents dgCustomers As System.Web.UI.WebControls.DataGrid

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

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

#End Region

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 conMain As SqlConnection
Dim sqlCmd As SqlCommand
Dim strConn As String

Try

strConn = ""
strConn = strConn & "Network Library=dbmssocn;"
strConn = strConn & "Password=myPassword;"
strConn = strConn & "User ID=myUser;"
strConn = strConn & "Initial Catalog=myDB;"
strConn = strConn & "Data Source=000.000.000.000;"

conMain = New SqlConnection(strConn)
sqlCmd = New SqlCommand("SELECT FirstName, LastName FROM
eNPCustomers", conMain)
conMain.Open()

Dim rdrCustomers As SqlDataReader = sqlCmd.ExecuteReader

dgCustomers.DataSource = rdrCustomers
dgCustomers.DataBind()

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 2078
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*********@eNetPortals.com> wrote in message
news:sI****************@newsread3.news.atl.earthli nk.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="eNP02.aspx.vb" autoeventwireup="false"
Inherits="eNPTest02.WebForm1"%>
<%@ Page Language="vb" codebehind="eNP02.aspx.vb" autoeventwireup="false"
Inherits="WebForm1"%>
<%@ Page Language="vb" src="eNP02.aspx.vb" autoeventwireup="false"
Inherits="eNPTest02.WebForm1"%>
<%@ Page Language="vb" src="eNP02.aspx.vb" autoeventwireup="false"
Inherits="WebForm1"%>

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="eNP02.aspx.vb" autoeventwireup="false"
Inherits="eNPTest02.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.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" codebehind="eNP02.aspx.vb" autoeventwireup="false"
Inherits="WebForm1"%>

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="eNPTest02.WebForm1"%>

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

Run on remote host
Parser Error Message: The base type 'eNPTest02.WebForm1' 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="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
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="WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>

<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>

<body MS_POSITIONING="GridLayout">
<TABLE height="310" cellSpacing="0" cellPadding="0" width="359"
border="0" ms_2d_layout="TRUE">
<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="TRUE">
<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="Solid">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.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data.SqlClient

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents dgCustomers As System.Web.UI.WebControls.DataGrid

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

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

#End Region

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 conMain As SqlConnection
Dim sqlCmd As SqlCommand
Dim strConn As String

Try

strConn = ""
strConn = strConn & "Network Library=dbmssocn;"
strConn = strConn & "Password=myPassword;"
strConn = strConn & "User ID=myUser;"
strConn = strConn & "Initial Catalog=myDB;"
strConn = strConn & "Data Source=000.000.000.000;"

conMain = New SqlConnection(strConn)
sqlCmd = New SqlCommand("SELECT FirstName, LastName FROM
eNPCustomers", conMain)
conMain.Open()

Dim rdrCustomers As SqlDataReader = sqlCmd.ExecuteReader

dgCustomers.DataSource = rdrCustomers
dgCustomers.DataBind()

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****************@TK2MSFTNGP09.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*********@eNetPortals.com> wrote in message
news:sI****************@newsread3.news.atl.earthli nk.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="eNP02.aspx.vb"
autoeventwireup="false" Inherits="eNPTest02.WebForm1"%>
<%@ Page Language="vb" codebehind="eNP02.aspx.vb" autoeventwireup="false" Inherits="WebForm1"%>
<%@ Page Language="vb" src="eNP02.aspx.vb" autoeventwireup="false"
Inherits="eNPTest02.WebForm1"%>
<%@ Page Language="vb" src="eNP02.aspx.vb" autoeventwireup="false"
Inherits="WebForm1"%>

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="eNP02.aspx.vb" autoeventwireup="false" Inherits="eNPTest02.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.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" codebehind="eNP02.aspx.vb"
autoeventwireup="false" Inherits="WebForm1"%>

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="eNPTest02.WebForm1"%>

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

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

Run on remote host
Parser Error Message: The base type 'eNPTest02.WebForm1' 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="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
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="WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>

<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>

<body MS_POSITIONING="GridLayout">
<TABLE height="310" cellSpacing="0" cellPadding="0" width="359"
border="0" ms_2d_layout="TRUE">
<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="TRUE">
<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="Solid">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.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data.SqlClient

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents dgCustomers As System.Web.UI.WebControls.DataGrid

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

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

#End Region

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 conMain As SqlConnection
Dim sqlCmd As SqlCommand
Dim strConn As String

Try

strConn = ""
strConn = strConn & "Network Library=dbmssocn;"
strConn = strConn & "Password=myPassword;"
strConn = strConn & "User ID=myUser;"
strConn = strConn & "Initial Catalog=myDB;"
strConn = strConn & "Data Source=000.000.000.000;"

conMain = New SqlConnection(strConn)
sqlCmd = New SqlCommand("SELECT FirstName, LastName FROM
eNPCustomers", conMain)
conMain.Open()

Dim rdrCustomers As SqlDataReader = sqlCmd.ExecuteReader

dgCustomers.DataSource = rdrCustomers
dgCustomers.DataBind()

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
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...
0
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...
0
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...
3
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...
4
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...
3
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...
7
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....
3
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. ...
0
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...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made but the http to https rule only works for...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...

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.