Using ASP.NET style connection in VB.NET

ez416

Member
Joined
Apr 17, 2007
Messages
9
Programming Experience
1-3
In Web forms, i have my connection string in web.config

HTML:
<add name="Oraconn"connectionString="Data Source=testdb;User ID=test;Password=test;Unicode=True"
providerName="System.Data.OracleClient" />

and this is how I use it if I want to access the data

VB.NET:
Dim OraCON As New OracleConnection(ConfigurationManager.ConnectionStrings("Oraconn").ConnectionString)
 
Dim CHKcmd As New OracleCommand("SELECT * FROM TEST_TBL", OraCON)
OraCON.Open()
Dim CHKval As OracleDataReader = CHKcmd.ExecuteReader()
If CHKval.Read Then
textbox1.text = chkval("test_field")
end if
1.) What I need is how I can use this style in VB.net. wherein there is a public connection string I'll just have to access.:confused:

2.) How can I use this if I want this to fill my datagrid without using datasets & adapters. :confused:

please help.
 
Last edited by a moderator:
Dont do that; it's bad for a variety of reasons.

Read the PQ link in my signature, then read the DW2 link, sections on "Simple App" for starters, then go wherever your head feels like reading..
 
Back
Top