Solved

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

Posted on 2016-07-18
7
36 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
Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

 

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

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

691 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