Hola Root ¿Como estas? bueno, mi codijo es enorme auanque de seguro hay unos mas enormes
pero, en realidad estoy haciendo esto cree un clase con todo los parametros de acceso a datos
Aqui te pongo el codigo
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using Rainbow.Configuration;
namespace Rainbow.DesktopModules
{
public class SolicitudEmpleoDB
{
/// <summary>
/// GetSingleSolicitudEmpleo
/// </summary>
/// <param name="SolicitudID">SolicitudID</param>
/// <returns>A SqlDataReader</returns>
public SqlDataReader GetSingleSolicitudEmpleo(int SolicitudID)
{
// Create Instance of Connection and Command Object
SqlConnection myConnection = PortalSettings.SqlConnectionString;
SqlCommand myCommand = new SqlCommand("GetSingleSolicitudEmpleo", myConnection);
// Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure;
// Add Parameters to SPROC
SqlParameter parameterSolicitudID = new SqlParameter("@SolicitudID", SqlDbType.Int);
parameterSolicitudID.Value = SolicitudID;
myCommand.Parameters.Add(parameterSolicitudID);
// Execute the command
myConnection.Open();
SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConne ction);
// Return the datareader
return result;
}
/// <summary>
/// GetSolicitudEmpleo
/// </summary>
/// <param name="SolicitudID">SolicitudID</param>
/// <returns>A SqlDataReader</returns>
public SqlDataReader GetSolicitudEmpleo(int ModuleId)
{
// Create Instance of Connection and Command Object
SqlConnection myConnection = PortalSettings.SqlConnectionString;
SqlCommand myCommand = new SqlCommand("GetSolicitudEmpleo", myConnection);
// Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure;
// Add Parameters to SPROC
SqlParameter parameterModuleId = new SqlParameter("@ModuleId", SqlDbType.Int);
parameterModuleId.Value = ModuleId;
myCommand.Parameters.Add(parameterModuleId);
// Execute the command
myConnection.Open();
SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConne ction);
// Return the datareader
return result;
}
/// <summary>
/// DeleteSolicitudEmpleo
/// </summary>
/// <param name="SolicitudID">SolicitudID</param>
/// <returns>Void</returns>
public void DeleteSolicitudEmpleo(int SolicitudID)
{
// Create Instance of Connection and Command Object
SqlConnection myConnection = PortalSettings.SqlConnectionString;
SqlCommand myCommand = new SqlCommand("DeleteSolicitudEmpleo", myConnection);
// Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure;
// Add Parameters to SPROC
SqlParameter parameterSolicitudID = new SqlParameter("@SolicitudID", SqlDbType.Int);
parameterSolicitudID.Value = SolicitudID;
myCommand.Parameters.Add(parameterSolicitudID);
// Execute the command
myConnection.Open();
myCommand.ExecuteNonQuery();
myConnection.Close();
}