PDA

Click to See Complete Forum and Search --> : comman Connection


khalik_ash
Jan 13th, 2003, 12:41 AM
hi

i am a vb programmer .. petty new to asp.net
as we have a public connection object in module can we have a connection.

i have some events which connection to database and retrive the database....

can i have a .. if so how and where do i need to declare it


regards

khalik_ash
Jan 17th, 2003, 04:26 AM
:eek: :mad: :confused: :rolleyes: make :) :D :p ;) :cool:

Cander
Jan 17th, 2003, 09:47 AM
huh? Your question makes no sense!

khalik_ash
Jan 18th, 2003, 12:24 AM
Originally posted by Cander
huh? Your question makes no sense!


my mistake... when u are new u dont know ur problem to right...

ok...

as we have connection object in module in vb6 can we have connection object in asp.net module.

will it be the same as vb

i tried it the connect is shared... but i can have only one datareader is it so or do we have a way of doing....


i need to share connection datareader object across pages as we do in vb

hope this time i make some sense:D

Cin0s3
Jan 19th, 2003, 10:06 PM
You can add it in your web.config file in an appsettings block

<appsettings>
<add key="constring" value="data source=localhost;initial catalog=northwind;UID=sa;Pwd=;"/>
</appSettings>


Then access it like so:


Imports System.Collections.Specialized


Dim appsetting As NameValueCollection = CType(HttpContext.Current.GetConfig("appSettings"), NameValueCollection)
conn = CStr(appsetting("constring"))

khalik_ash
Jan 20th, 2003, 05:04 AM
Originally posted by Cin0s3
You can add it in your web.config file in an appsettings block

<appsettings>
<add key="constring" value="data source=localhost;initial catalog=northwind;UID=sa;Pwd=;"/>
</appSettings>


Then access it like so:


Imports System.Collections.Specialized


Dim appsetting As NameValueCollection = CType(HttpContext.Current.GetConfig("appSettings"), NameValueCollection)
conn = CStr(appsetting("constring"))



dont u think this will share the connect string rather than the connection object.

if u see my Q.. it is diff i am trying to open more than one datareader with same connection object

any way thanks a lot for tip

MrNorth
Jan 20th, 2003, 12:47 PM
This connection object of yours, is it like a vb module, or a compiled business object, like a dll file??? More info please.
Whenever I need database support to my asp.net pages I use my db.dll file in which I have all the logic behind connections. Reuse code is the way to do it :)

kind regards
Henrik

khalik_ash
Jan 21st, 2003, 05:17 AM
i have connection object in module as we have in vb.

my point is not behind connecting .. can we have more than one datareader object for same connection.