gearbolt
Dec 8th, 2004, 09:40 PM
I cant get this program to compile. I have a Vb class file called dbconn.vb
which has the Database stuff in it and a function called "fallen".
When I try to access the "fallen" function from my Aspx file Visual Studio returns an error " Name fallen is not declared".
What did I miss
Thanks for the help the code is below.
dbconn.vb
Imports System.Data.SqlClient
Public Class dbconn
Private Shared ReadOnly Property ConnectionString() As String
Get
Return ConfigurationSettings.AppSettings("ConnectionString")
End Get
End Property
Public Function GetEmployeeName()
'Public Function GetEmployeeName() As SqlDataReader
' Create the connection object
Dim SqlConnection As New SqlConnection(ConnectionString)
'Create the command object
Dim command As New SqlCommand("Select * from Employess", SqlConnection)
Try
SqlConnection.Open()
Catch ex As Exception
End Try
SqlConnection.Close()
weborm1.aspx
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 TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Label2 As System.Web.UI.WebControls.Label
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
'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
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
fallen()
End Sub
End Class
which has the Database stuff in it and a function called "fallen".
When I try to access the "fallen" function from my Aspx file Visual Studio returns an error " Name fallen is not declared".
What did I miss
Thanks for the help the code is below.
dbconn.vb
Imports System.Data.SqlClient
Public Class dbconn
Private Shared ReadOnly Property ConnectionString() As String
Get
Return ConfigurationSettings.AppSettings("ConnectionString")
End Get
End Property
Public Function GetEmployeeName()
'Public Function GetEmployeeName() As SqlDataReader
' Create the connection object
Dim SqlConnection As New SqlConnection(ConnectionString)
'Create the command object
Dim command As New SqlCommand("Select * from Employess", SqlConnection)
Try
SqlConnection.Open()
Catch ex As Exception
End Try
SqlConnection.Close()
weborm1.aspx
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 TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Label2 As System.Web.UI.WebControls.Label
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
'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
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
fallen()
End Sub
End Class