P
PRTC
I'm trying to use the global.asax in my new web aplication proyect
using the Application start to store my connection string
GLOBAL.ASAX.vb
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Dim objConnection As OleDbConnection
Dim daContent As OleDbDataAdapter
Dim objDataReader As OleDbDataReader
Dim objCommand As New OleDbCommand
Dim mySqlStatment As String = "Select * FROM materia1Links_cl"
objConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=D:\works\WEBS\edusalon\dbcontainer\datdb.mdb")
End Sub
The problem is, when I try to use this code in the
Webform1.aspx
Code inside of the HTML
<Script language="vb" runat ="server"
DIM mySqlStatment AS STRING = "Select * FROM materia1Links_cl"
try
objConnection.open()
objDataReader = objCommand.ExecuteReader()
DO WHILE objDataReader.Read()= true
Response.write(objDataReader("mycolum"))
loop
objDataReader.close()
objConnection.close()
Catch e as EXCEPTION
end try
end Sub
</script>
The error generated are my variables ar not declare objConnection,
objDataReader ... I m not really sure what I'm doing wrong
I thoght that when I place my variables in the globlas asax thay going to be
available each time I open the web application
did somebody know how is the correct way to use the Application_Start with
my connection string in it and how my others form
can use it. thanks
using the Application start to store my connection string
GLOBAL.ASAX.vb
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Dim objConnection As OleDbConnection
Dim daContent As OleDbDataAdapter
Dim objDataReader As OleDbDataReader
Dim objCommand As New OleDbCommand
Dim mySqlStatment As String = "Select * FROM materia1Links_cl"
objConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=D:\works\WEBS\edusalon\dbcontainer\datdb.mdb")
End Sub
The problem is, when I try to use this code in the
Webform1.aspx
Code inside of the HTML
<Script language="vb" runat ="server"
DIM mySqlStatment AS STRING = "Select * FROM materia1Links_cl"
try
objConnection.open()
objDataReader = objCommand.ExecuteReader()
DO WHILE objDataReader.Read()= true
Response.write(objDataReader("mycolum"))
loop
objDataReader.close()
objConnection.close()
Catch e as EXCEPTION
end try
end Sub
</script>
The error generated are my variables ar not declare objConnection,
objDataReader ... I m not really sure what I'm doing wrong
I thoght that when I place my variables in the globlas asax thay going to be
available each time I open the web application
did somebody know how is the correct way to use the Application_Start with
my connection string in it and how my others form
can use it. thanks