Visual Studio 2012 How to find the existing connection string

huerita37
huerita37 used Ask the Experts™
on
I need to update a project and I am looking for the DB connection string.  It is not in an obvious place.  Here is how we call the DB.
String cs3 = "INSERT INTO tblWP_TS_Day VALUES(NEWID(),@sd,@st,@et,@lit,@lot,@nt,@ot,@sit,@hot,@vat,@tt,@euk,@ct,'');";
                        Cm.ex(Cm.plw, cs3, null, ch, null, null, null, null, null, null, false);

Open in new window


The 'plw' contains the connection string but I can't find where that is set.  I right clicked on it and went to 'Go To Definition' and it brought me to this.

namespace BaseClassLibrary
{
    public class Cm
    {
        public static string cp;
        public static string plc;
        public static string pld;
        public static string pldt;
        public static string plw;

        public Cm();

        public static string ex(string cmm, string fc, string cmt, Hashtable ch, string ot, Ob rob, ArrayList al, Ts gts, Dl gdl, Label rl, bool q);
    }
}

Open in new window


I am trying to find where these variables are set.  I've done a search on the whole project and nothing shows up.  I am thinking there is a 'behind the scenes' spot where it can be set in a project.  I've looked in the 'Properties' page and clicked through each link and can't find it.  

Any idea?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
do you even know the name of the database? try searching for your database name or your username in the whole project, Since we can see the rest of the code I would also look into ODBC data sources in control panel. or in the project DATASOURCES

Author

Commented:
Where do I find the project DataSources?  I have tried to search for my database name and can't find it.

Author

Commented:
I clicked on the 'Data Sources' on the far left and it states that there are none to show.
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

do you have any  third party addons in your project? (infrgistics or similar? ), or data binding controls? if you have then the connection might be a property in one of them:

    DataColumn
    DataTable
    DataView
    DataSet
    DataViewManager

Author

Commented:
Can you set variables in a library?
I mean in design mode control properties.

Author

Commented:
I found it.  I was stepping through my program and it brought me to a page that had all of the variables for the DB set.  It is called Cm.cs.  I am looking for this page under the Solution Explorer and I don't see it.  Because of the extension '.cs' I looked under the 'Classes' and I don't see 'Cm.cs' there, I also looked in all of those links.

Any idea of how to find this page again?

Author

Commented:
The namespace is BaseClassLibrary.  How do I get to this file?
CS is for C Sharp,
it's maybe included or called from some other file not inside your solution, open your solution folder and search for it there

Author

Commented:
I found it by looking through the files on my computer.  This file is used on all my programs, which makes sense.  

What I don't get is that I load this library on my program but I wasn't able to search in it or access it unless I step through my code and it loads that page or I open it using 'File - Open'.  Is there any other way of opening it?
ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
Is this code obfuscated? Your variable names don't look very sensible, which is usually the kind of thing an obfuscator would do.

Author

Commented:
The variables are very obfuscated but I am unable to change the code that was already written.  :-(

Author

Commented:
Thank you for all of your help.  I know I didn't give much to go on but I didn't know what to give.  

Thanks again!!!
ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
OK, the variables are, but I'm specifically asking if your code is obfuscated. Because typically obfuscators will have logic built in that defeats reverse engineering the code (for hopefully obvious reasons). If this code was run through an obfuscator, then you'll probably have a difficult time tracing through it.

Author

Commented:
The person who wrote the program did not write any notes or very few.  I have never heard of an obfuscator before.  I doubt the programmer used one.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial