473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Data Objects for Win and Web

We have a set of objects that use a DAL to connect to SQLServer. The
database they will be using is selected during login. Where is the best
place to hold this information so the DAL can use it no matter if it is Web
or Win.

Phenix
Nov 16 '05 #1
2 978
The options are completely different for web or Windows applications so if
you're looking for one "best place" you might not find it.

You could, but I wouldn't recommend it, create an static ArrayList property
in your DAL that you could register users and the appropriate database but
then you'd have to handle logouts, broken connections, and other concurrency
issues.

You could just set an instance property with the appropriate value in the DAL

Alternatively, you could issue an SQL command to change the default database
for the user when they log in and then do not include the "initial catalog"
section in the connection string. The user will default to their configured
default database.

For web, you can use Session state or Viewstate objects to store the
database name.

For Windows, you can store the value in the registry, in an appropriately
scoped variable or class or even in an XML configuration file.

HTH

DalePres
MCAD, MCDBA, MCSE
"Phenix Smith" wrote:
We have a set of objects that use a DAL to connect to SQLServer. The
database they will be using is selected during login. Where is the best
place to hold this information so the DAL can use it no matter if it is Web
or Win.

Phenix

Nov 16 '05 #2
Thanks for the information. I found in another post that I can test if the
Application is a Web or Win App by checking the HttpContext.Current. This
will work, I can create a Cache object that accesses an ArrayList or the
Current Session depending on app type.

Phenix

"Dale" <Da******@eMmeSseNn.com> wrote in message
news:7F**********************************@microsof t.com...
The options are completely different for web or Windows applications so if
you're looking for one "best place" you might not find it.

You could, but I wouldn't recommend it, create an static ArrayList property in your DAL that you could register users and the appropriate database but
then you'd have to handle logouts, broken connections, and other concurrency issues.

You could just set an instance property with the appropriate value in the DAL
Alternatively, you could issue an SQL command to change the default database for the user when they log in and then do not include the "initial catalog" section in the connection string. The user will default to their configured default database.

For web, you can use Session state or Viewstate objects to store the
database name.

For Windows, you can store the value in the registry, in an appropriately
scoped variable or class or even in an XML configuration file.

HTH

DalePres
MCAD, MCDBA, MCSE
"Phenix Smith" wrote:
We have a set of objects that use a DAL to connect to SQLServer. The
database they will be using is selected during login. Where is the best
place to hold this information so the DAL can use it no matter if it is Web or Win.

Phenix

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Geoff Biggs | last post by:
Evening all, I'm trying to add a new built-in number data type to Python with its own syntax, so I'm working directly with the interpreter rather than creating my own extension module (side...
0
by: GreenFROG Design | last post by:
Data Processing and SQL INSERTING Hello guy's i'm faced with a horrible dilemma i have whole dictionary that i have to enter into a database. I have all the text and i would like to convert it...
16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
9
by: Tony Lee | last post by:
Some time a ago, on this newsgroup the following comments were made in recommending good references for Access (2003) >I used to recommend Dr. Rick Dobson's, "Programming Access <version>" for...
6
by: kobu.selva | last post by:
I was recently part of a little debate on the issue of whether constants and string literals are considered "data objects" in C. I'm more confused now than before. I was always under the...
2
by: jason | last post by:
the enterprise is going to eventually convert the existing ASP Classic website to ASP.NET until that time, development has already begun for a C# library of business objects. for the most part,...
5
by: Shibu | last post by:
Hi, I have a situation where I need to convert business objects to a flat table. The reverse is also required. I am using c# and Oracle ODP. I am looking for an easier method to do the below...
1
by: Patrick | last post by:
Hi all, New to .NET, I'm working on an Winforms client application using VS 2005 beta2. My needs considering data storage are the followings: (1) Small files (0 < length < 10 mb), containing...
0
by: sonu | last post by:
I have following client side code which i have used in my asp.net project SummaryFeatured Resources from the IBM Business Values Solution Center WHITEPAPER : CRM Done Right Improve the...
8
by: CedricCicada | last post by:
Greetings! Here's my script: ######## start of script class ScannerCommand: taskName = '' scanList = def __init__(self):
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.