I'm busy building an application with classes.
one class works perfect, so i add a second one.
The class compiles great.
But i can't use it in the source of the program, the program gives the following error:
My class:
Main source:
Whats wrong?
The error is on this line:
using statistieken;
Thanks... Jelmer
one class works perfect, so i add a second one.
The class compiles great.
But i can't use it in the source of the program, the program gives the following error:
The type of namespace name 'statistieken' could not be found (you are missing uing...
My class:
C#:
using System;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Globalization;
using Ini;
namespace WindowsApplication2
{
class statistieken
{
public statistieken()
{
}
static OleDbConnection dbase(OleDbConnection Connection)
{
IniFile ini = new IniFile("test.ini");
string database;
database = ini.IniReadValue("Info", "Database");
string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;";
connectionString += @"Data Source=" + database + ";";
Connection.ConnectionString = connectionString;
Connection.Open();
return Connection;
}
public int aantalklanten()
{
int hoeveelheid = 0;
try
{
OleDbConnection Connection = new OleDbConnection();
Connection = dbase(Connection);
// Create an OleDb command,
OleDbCommand myCommand = new OleDbCommand("count (*) from Bedrijven", Connection);
Connection.Open();
OleDbDataReader myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
while (myReader.Read())
{
hoeveelheid = Convert.ToInt32(myReader.GetString(0));
}
Connection.Close();
return hoeveelheid;
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
return hoeveelheid;
}
}
}
}
Main source:
C#:
using customers;
[U]using statistieken;[/U]
private void button1_Click(object sender, System.EventArgs e)
{
statistieken stats = new statistieken();
int hoeveelheid = stats.aantalklanten();
Whats wrong?
The error is on this line:
using statistieken;
Thanks... Jelmer
Last edited by a moderator: