C sharp - Error extraño

 
Vista:

Error extraño

Publicado por Carlos (2 intervenciones) el 24/02/2007 02:23:21
Hola, estoy tratando de conectar postgres con c# y hice el siguiente programa para testear la conexion pero me da un error que no se que es cuando presiono el boton. el codigo es como sigue:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Npgsql;

namespace WindowsApplication1
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(72, 8);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(112, 24);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button1});
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
public static void Main()
{
Application.Run(new Form1());
}

private void button1_Click(object sender, System.EventArgs e)
{
try
{
string connectionString =
"Server=localhost;" +
"Database=prueba;" +
"User ID=postgres;" +
"Password=ninguna;";
IDbConnection dbcon;
dbcon = new NpgsqlConnection(connectionString);
dbcon.Open();
dbcon.Close();
dbcon = null;
}
catch
{
MessageBox.Show("Se capturo un error.");
}

}
}
}

y el mensaje de error es:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in system.windows.forms.dll

Additional information: File or assembly name System, or one of its dependencies, was not found.

Les agradeceria me digan que ocurre y si es posible como solucionarlo.
Gracias.
Saludos.

Carlos
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Error extraño

Publicado por ramon morales (4 intervenciones) el 26/02/2007 03:32:20
checa si tienes referenciado System en tu refererencias del projecto
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Error extraño

Publicado por Carlos (2 intervenciones) el 26/02/2007 14:26:02
Hola, ya resolvi el problema, no tiene nada que ver con el codigo ni ocn las referencias, el IDE del VC 2002(frameowrk 1) genera conflicto no se porque y me da ese error. Instale el # Develop y el mismo codigo funciona sin problemas.
Gracias por la ayuda de todas maneras.

Carlos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar