Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/09/2012, 16:28
Widrogo
 
Fecha de Ingreso: septiembre-2012
Mensajes: 14
Antigüedad: 12 años, 4 meses
Puntos: 0
Pregunta programacion en 3 capas c# aplicacion

3 ERRORES
ESTOS 2 QUE NO TENGO IN IDEA QUE ES BUSQUE UN MONTÓN EN INTER Y NINGUNO DA UNA SOLUCIÓN BUENA:

Error 1 Metadata file 'C:\Users\Widrogo\Documents\Visual Studio 2010\Projects\ingsoft\datosPHO\bin\Debug\datosPHO. exe' could not be found controlPHO

Error 2 Metadata file 'C:\Users\----\---\Visual Studio 2010\Projects\ingsoft\datosPHO\bin\Debug\datosPHO. exe' could not be found controlPHO


Y ESTE ULTIMO


Error 3 'datosPHO.DatosPHO.Insertar(int, string, string, string, string, int, int, int, string, string, double, string)': not all code paths return a value C:\Users\Widrogo\Documents\Visual Studio 2010\Projects\ingsoft\datosPHO\Program.cs 34 20 datosPHO




AGRADECERÍA MAS LA AYUDA CON LOS DOS PRIMEROS AUNQUE SON CASI LO MISMO PERO LAS REFERENCIAS LAS REVISE ESTAN BIEN.

LA VERDAD SIEMPRE PROGRAME EN PHP JAMAS ME TOPE CON ESTE TIPO DE ERRORES.

ES C# APLICACION EN 3 CAPAS.

AQUI LES DEJO EL CODIGO:

ES UN FORM DONDE RECIBO DATOS AQUI NO ES EL PROBLEMA PERO ES LA PRIMERA

Código C#:
Ver original
  1. :
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data.SqlClient;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Windows.Forms;
  11. using controlPHO;
  12.  
  13. namespace WindowsFormsApplication3
  14. {
  15.     public partial class Form1 : Form
  16.     {
  17.         public Form1()
  18.         {
  19.             InitializeComponent();
  20.         }
  21.         private void btnRegistrar_Click(object sender, EventArgs e)
  22.         {
  23.             Phoenix_Control control = new Phoenix_Control();
  24.             int codigo = int.Parse(txtcarnet.Text);
  25.             string nombres = txtnombre.Text;
  26.             string ap_pat = txtapepat.Text;
  27.             string ap_mat = txtapmat.Text;
  28.             string area = cambo_area.Text;
  29.             int telefono = int.Parse(txt_tele.Text);
  30.             int celular = int.Parse(txtcel.Text);
  31.             int tel_emer = int.Parse(txt_emer.Text);
  32.             string direccion = txtdireccion.Text;
  33.             string capacitacion = combocapa.Text;
  34.             double experiencia = double.Parse(txt_expe.Text);
  35.             string cargo = txt_cargos.Text;
  36.             control.insertar_datos(codigo, nombres, ap_pat, ap_mat, area, telefono, celular, tel_emer, direccion, capacitacion, experiencia, cargo);
  37.         }
  38.      
  39.     }
  40. }

Código C#:
Ver original
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. using datosPHO;
  6.  
  7. namespace controlPHO
  8. {
  9.     public class Phoenix_Control
  10.     {
  11.         public int insertar_datos(int codigo, string nombres, string ap_pat, string ap_mat, string area, int telefono, int celular, int tel_emer, string direccion, string capacitacion, double experiencia, string cargo)
  12.         {
  13.             DatosPHO envio_datos = new DatosPHO();
  14.             int resultado = envio_datos.Insertar(codigo, nombres, ap_pat, ap_mat, area, telefono, celular, tel_emer, direccion, capacitacion, experiencia, cargo);
  15.             return resultado;
  16.  
  17.         }
  18.  
  19.     }
  20. }



AQUI ES EL TERCER ERROR

Código C#:
Ver original
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. using System.Data.SqlClient;
  6.  
  7. namespace datosPHO
  8. {
  9.        
  10.     public class Conexion
  11.     {
  12.  
  13.             private SqlConnection Con; // Obj Conexion
  14.             public Conexion()
  15.             {
  16.                 string DtsConection = "Data Source=(local);Initial Catalog=phoenix_bd;Integrated Security=True";
  17.                 Con = new SqlConnection(DtsConection);
  18.             }
  19.             public void Abrir() // Metodo para Abrir la Conexion
  20.             {
  21.                 Con.Open();
  22.             }
  23.             public void Cerrar() // Metodo para Cerrar la Conexion
  24.             {  
  25.                 Con.Close();
  26.             }
  27.            
  28.            
  29.  
  30.         }
  31.  
  32.     public class DatosPHO
  33.     {
  34.         public int Insertar(int codigo, string nombres, string ap_pat, string ap_mat, string area, int telefono, int celular, int tel_emer, string direccion, string capacitacion, double experiencia, string cargo)
  35.         {
  36.             Conexion cn = new Conexion();
  37.             string sel = "";
  38.             SqlCommand cmd = new SqlCommand(sel);
  39.             cmd.Parameters.AddWithValue("@id_personal", codigo);
  40.  
  41.             cmd.Parameters.AddWithValue("@nombre", nombres);
  42.             cmd.Parameters.AddWithValue("@ap_pat", ap_pat);
  43.             cmd.Parameters.AddWithValue("@ap_mat", ap_mat);
  44.            // cmd.Parameters.AddWithValue("@codigo", area);
  45.             cmd.Parameters.AddWithValue("@telefono", telefono);
  46.             cmd.Parameters.AddWithValue("@celular", celular);
  47.             cmd.Parameters.AddWithValue("@direccion", tel_emer);
  48.             cmd.Parameters.AddWithValue("@num_emergencia", direccion);
  49.             cmd.Parameters.AddWithValue("@nivel_capacitacion", capacitacion);
  50.             cmd.Parameters.AddWithValue("@experiencia_anios", experiencia);
  51.             cmd.Parameters.AddWithValue("@cargos_desempenados", cargo);
  52.            
  53.             try
  54.             {
  55.                 cn.Abrir();                  
  56.                 int query = cmd.ExecuteNonQuery();
  57.                 return query;
  58.             }
  59.             catch (Exception ex)
  60.             {
  61.                 MessageBox.Show(ex.ToString());
  62.             }
  63.             finally
  64.             {
  65.                 cn.Cerrar();
  66.             }
  67.            
  68.         }
  69.  
  70.     }
  71.    
  72. }