Solved

Adding data to a DLL and using the DLL in a c# program

Posted on 2016-07-18
7
35 Views
Last Modified: 2016-07-19
I have a dll that holds all of our connection strings.  I can use this dll in all my other programs.  I have no problem accessing any information in this dll currently.

Now I need to add a connection string and I am getting an error:

'BaseClassLibrary.Cm' does not contain a definition for 'cpt'.

FYI - 'cpt' is the new connection string.  

I am using Visual Studio 2012.  Do I need to remove the dll from my project and then add it again?  

Here is how I call the data that is in the dll:

Cm.ex(Cm.cpt, strSQL, null, ch, "BaseClassLibrary.At", at, null, null, null, null, true);

Open in new window



When I click on the 'Cm' and hit F12 I am taken to a page with this code.
using System;
using System.Collections;
using System.Windows.Forms;

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 try to add:
public static string cpt;

Open in new window


but I am unable to write in this file.  How can I do this?
0
Comment
Question by:huerita37
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 41718031
You state, "but I am unable to write in this file.  How can I do this? ", what error are you getting when you try to modify the file with that line of code?
0
 
LVL 34

Accepted Solution

by:
sarabande earned 500 total points
ID: 41718226
as far as i can see  from your snippet, you need to add static member

public static string cpt;

Open in new window


to the class.

probably you also have to define the connection string somewhere in the code.

Sara
0
 

Author Comment

by:huerita37
ID: 41719323
Fernando:  I am adding:

public static string cpt;

I have gone into the BaseClassLibrary project and I save it but when I look at the different projects that call BaseClassLibrary it is not there.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Assisted Solution

by:huerita37
huerita37 earned 0 total points
ID: 41719369
I opened the BaseClassLibrary project and made my changes in there.  I clicked 'Build Solution' but it was pointing to the 'Debug' folder and not the 'Release' folder.  Once I changed that I was able to see my changes in my other projects.
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 41719375
When you added the BaseClassLibrary.dll to the project that is using it, please right click on that dll in the Reference node in Solution Explorer select Properties from the short cut menu and make sure that the property "Copy Local" is set to True.
0
 
LVL 34

Expert Comment

by:sarabande
ID: 41719379
I have gone into the BaseClassLibrary project and I save it
... and where the connect string was set? check how the other connect strings were handled and do the same for 'cpt' variable.

but it was pointing to the 'Debug' folder and not the 'Release' folder.
you should do the build for both Debug and Release configuration.


Sara
1
 
LVL 34

Expert Comment

by:sarabande
ID: 41719393
Huerita,

if you wanted to share the points between Fernando and me, you may click at the 'Request Attention' button at the bottom of your original post.

Sara
1

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question