473,408 Members | 1,976 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,408 software developers and data experts.

passing parameter to class from application

Hi there,

I have a question, please give me some idea. Thanks in advance!

Solution1
|
|---DBLogic (class library)
| |
| |-dblogic (class) which defines ConnString, functions to create
DataTable by sqlstr
|
|
|---DBObjects (class library)
| |
| |-dbClients
| |
| |-dbEmployees.. etc
|
|
|---UI (main application/start project)
| |
| |-Forms and UI
| |-StartForm

my questions is, the ConnString is hard-coded in the DBLogic class, with
"server = xxx; database=xxxx; uid=sa; pwd=sapass", as said by the book i am
reading,

is it possible for me to read-in a text file with the UI\StartForm, and pass
those
information to dblogic class? and howto?

i am doing that way becuase i want to modify the sa password from time to
time, so
that all i have to change is the text file after change the sa's password.

Thanks again.
Smile
Nov 16 '06 #1
1 963
You should not hardcode the connection string in your program.
You should store it in the Application Settings for the Project
containing the Data Access Component. There is a Type field of
ConnectionString.

Then when you want to change it, you can change it in that one
place. And when you want to access it, you know where it is.

If you're using VB, you can then put it in your code as
My.Settings.MyConnectionString instead of the actual connection
string, and it will go get it from the settings file.

If you're not using VB, there's some way to get that connection
string out of the application settings, but I don't know what
it is. If you're using C#, re-post and ask for that info.

Also, it's *much* safer to set up your SQLServer database to
use Windows authentication, so you don't have a username and
password hardcoded anywhere.

Robin S
-------------------------

"Smile" <sm***@smile.comwrote in message
news:eL*************@TK2MSFTNGP04.phx.gbl...
Hi there,

I have a question, please give me some idea. Thanks in advance!

Solution1
|
|---DBLogic (class library)
| |
| |-dblogic (class) which defines ConnString, functions to create
DataTable by sqlstr
|
|
|---DBObjects (class library)
| |
| |-dbClients
| |
| |-dbEmployees.. etc
|
|
|---UI (main application/start project)
| |
| |-Forms and UI
| |-StartForm

my questions is, the ConnString is hard-coded in the DBLogic class, with
"server = xxx; database=xxxx; uid=sa; pwd=sapass", as said by the book i
am reading,

is it possible for me to read-in a text file with the UI\StartForm, and
pass those
information to dblogic class? and howto?

i am doing that way becuase i want to modify the sa password from time to
time, so
that all i have to change is the text file after change the sa's password.

Thanks again.
Smile


Nov 17 '06 #2

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

Similar topics

0
by: andreas | last post by:
Hi there, I have the following situation: 1. DOT.NET Application is started 2. DOT.NET Application instantiates Access.Application.8 3. Opens a specified database (MDB) 4. DOT.NET...
7
by: Ken Allen | last post by:
I have a .net client/server application using remoting, and I cannot get the custom exception class to pass from the server to the client. The custom exception is derived from ApplicationException...
6
by: wiredless | last post by:
What is the advantage of passing an interface type? according to UML (visio) when i reverse engineer existing code to a UML diagram I get the error "UMLE00046: sample : - An interface cannot...
3
by: Mark | last post by:
Hi From what I understand, you can pass arrays from classic ASP to .NET using interop, but you have to change the type of the.NET parameter to object. This seems to be because classic ASP passes...
0
by: Richard Buckshaw | last post by:
Mimick the older C/ pascal dll parameter passing convention? - VB Class Mod? Hello, I have been attempting to write a VB class that would expose its stuff to an older (ok, legacy application)...
7
by: Richard Grant | last post by:
Hi. In c/C++ i can pass the address of a subroutine to another subroutine as an actual parameter How do I do that in VB .NET What should be the syntax for a parameter to receive the address of a...
2
by: diffuser78 | last post by:
I wrote a small app in wxPython using wxGlade as designer tool. wxGlade brings and writes a lot of code by itself and thats where my confusion started. Its about parameter passing. Here is my...
10
by: amazon | last post by:
Our vender provided us a web service: 1xyztest.xsd file... ------------------------------------ postEvent PostEventRequest ------------------------------------- authetication authentication...
7
by: TS | last post by:
I was under the assumption that if you pass an object as a param to a method and inside that method this object is changed, the object will stay changed when returned from the method because the...
4
by: =?Utf-8?B?QmV0aA==?= | last post by:
Hello. I had a class that worked, but I knew wasn't designed correctly from an OO point of view, so I changed it so it was more like I thought it 'should' be, and now it doesn't always work....
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.