PC Review


Reply
Thread Tools Rate Thread

passing parameter to class from application

 
 
Smile
Guest
Posts: n/a
 
      16th Nov 2006
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


 
Reply With Quote
 
 
 
 
RobinS
Guest
Posts: n/a
 
      17th Nov 2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing a Variable, or Passing a Parameter ryguy7272 Microsoft Access VBA Modules 11 22nd May 2008 04:18 PM
Passing parameter to query without using Enter Parameter window Mike P Microsoft Access VBA Modules 3 23rd Dec 2007 08:53 PM
passing parameter to class from application Smile Microsoft VB .NET 2 20th Nov 2006 06:02 PM
passing any object as parameter to a function which takes Object class as parameter and fetching the members at runtime Ram Microsoft VB .NET 5 11th Oct 2005 08:24 PM
error STOP:0x0000007B (parameter, parameter, parameter, parameter) robert35 Microsoft Access Getting Started 1 15th Dec 2004 04:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:45 AM.