[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2016-07-18
7
Medium Priority
?
42 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 64

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 35

Accepted Solution

by:
sarabande earned 2000 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
Independent Software Vendors: 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!

 

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 64

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 35

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 35

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

656 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