473,394 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

class files into dll

I have created a project solution with two class projects.

One is used to give information about user and the other one is a dataset
connection properties.

The class with users has reference to dataset.

Now, I created an dll of those project solution.

But, when I call a public function "SetConnectionString(string sConnString)"
in users class I get an error : Object reference not set to an instance of
an object !

Why ?

public class in users :

using System;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using LoginDb;

namespace UserLogin

{

public class Logon

{

LoginDb.Db db = null;

public Logon()

{
}

public void SetConnectionString(string sConnString)

{

db = new Db(sConnString);

}

}

}

Hrcko
Nov 17 '05 #1
2 1076
Hrvoje Voda <hr*********@luatech.com> wrote:
I have created a project solution with two class projects.

One is used to give information about user and the other one is a dataset
connection properties.

The class with users has reference to dataset.

Now, I created an dll of those project solution.

But, when I call a public function "SetConnectionString(string sConnString)"
in users class I get an error : Object reference not set to an instance of
an object !

Why ?


Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

The obvious answer is that you may be calling SetConnectionString on a
null reference rather than on a reference to an instance of Logon.
Without seeing the calling code, it's impossible to say.

It's unlikely to be anything to do with doing it in a separate library
though.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #2
Hrcko:

1) I presume the sConnString is not null?

2) Judging by the code you posted this sounds like a problem in the LoginDB
Class constructor.

Try putting the db = new DB(sConnString) into a try... catch block and/or
step through what exactly happens in the DB constructor.
Review the exception information and stacktrace on where exactly the error
occured.
Bok,

Ziga Jakhel

"Hrvoje Voda" <hr*********@luatech.com> wrote in message
news:d7**********@ss405.t-com.hr...
I have created a project solution with two class projects.

One is used to give information about user and the other one is a dataset
connection properties.

The class with users has reference to dataset.

Now, I created an dll of those project solution.

But, when I call a public function "SetConnectionString(string
sConnString)" in users class I get an error : Object reference not set to
an instance of an object !

Why ?

public class in users :

using System;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using LoginDb;

namespace UserLogin

{

public class Logon

{

LoginDb.Db db = null;

public Logon()

{
}

public void SetConnectionString(string sConnString)

{

db = new Db(sConnString);

}

}

}

Hrcko

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Hal Vaughan | last post by:
My first Java project has gotten to the point where there are so many .java and .class files that I'd like to keep them separated so I can easily keep files straight. I have my /home/me directory...
2
by: Harold Ensle | last post by:
Has anyone ever had this problem? I have been compiling servlet files, correcting them, recompiling them and seeing the changes on the next URL request. So everything was going smoothly. Suddenly...
7
by: A_StClaire_ | last post by:
hi, I'm working on a project spanning five .cpp files. each file was used to define a class. the first has my Main and an #include for each of the other files. problem is my third file...
14
by: Mick | last post by:
I wrote a C# program that interfaces with a data vendor over the web using an API they supplied and their examples in C#. Now I have another data vendor's API and example that I want to add to...
16
by: pawel.pabich | last post by:
Hajo, I would like to have 2 my own partial classes. For example: Default.aspx.cs Default2.aspx.cs and they both will relate to Default.aspx page.
11
by: Kimmo Laine | last post by:
I'm flipping my wig here, people. I'm using classes and making each class a file. when I'm including dependet classess, I use require_once to avoid multiple declarations - yet they happen. I put...
0
by: Herman Jones | last post by:
I'm getting the following error when I build a Class Library project: Embedding manifest... Project : error PRJ0002 : Error result 1 returned from 'C:\WINDOWS\system32\cmd.exe'. It happens with...
32
by: Matias Jansson | last post by:
I come from a background of Java and C# where it is common practise to have one class per file in the file/project structure. As I have understood it, it is more common practice to have many...
5
by: Marcin Gil | last post by:
Hi! I have the code like this (obvious things like ctor/dtor removed) typedef struct _NODE { int val; int index; } Node;
2
by: yalbizu | last post by:
#include <iostream> #include <string> #include <fstream> #include <iomanip> using namespace std; const int NO_OF_STUDENTS=20; struct studentType { string studentFName; string studentLName;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.