Ver Mensaje Individual
  #16 (permalink)  
Antiguo 23/06/2011, 14:09
acse
 
Fecha de Ingreso: agosto-2010
Ubicación: mexico
Mensajes: 125
Antigüedad: 13 años, 8 meses
Puntos: 0
Exclamación Respuesta: descripcion de codigo C#.NET

Este es el codigo,

aun me falta poner lo de los radiobutton, ya que en mi consulta no se como poner lo del rango de la fecha. y pues lo del jajajaj tambien no se como omitirlo y que solo salga mensaje cuando no se cumpla la busqueda.......

Código PHP:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace CobXKAMEX
{
    public 
partial class Form1 Form
    
{

        
        private 
SqlDataAdapter sqlDataAdapter1;
        private 
DataSet ds;


        public 
Form1()
        {
            
InitializeComponent();
        }

        private 
void btBuscar_Click(object senderEventArgs e)
        {
            if(
txtcuenta.Text.Length == 0
            {
                
MessageBox.Show("Ingrese Numero de Cuenta","Mensaje");
            }

            if (
txtcliente.Text.Length == 0)
            {
                
MessageBox.Show("Ingrese de Cliente""Mensaje");
            }
            else
            {
                try
                {


                    {

                        
string conexion "Data Source=,1433;Initial Catalog=2010SW;User ID=EuroWin;Password=ew#211218";

                        
SqlConnection cnn = new SqlConnection(conexion);


                        
SqlCommand cmd = new SqlCommand("SELECT  c_albven.factura, c_albven.cliente, asientos.cuenta, asientos.fecha, c_albven.fecha AS Expr1, asientos.debe, asientos.haber, clientes.nombre, asientos.definicion FROM asientos INNER JOIN c_albven ON asientos.factura = c_albven.factura INNER JOIN clientes ON c_albven.cliente = clientes.codigo WHERE   (asientos.cuenta = @cuenta) AND (c_albven.factura <> @factura) OR (c_albven.cliente = @cliente)"cnn);

                        
cmd.Parameters.Add("@cuenta"SqlDbType.VarChar).Value txtcuenta.Text;
                        
cmd.Parameters.Add("@factura"SqlDbType.VarChar).Value txtfactura.Text;
                        
cmd.Parameters.Add("@cliente"SqlDbType.VarChar).Value txtcliente.Text;

                        
cnn.Open();

                        
sqlDataAdapter1 = new SqlDataAdapter(cmd);


                        
ds = new DataSet();

                        
sqlDataAdapter1.Fill(ds"asientos");

                        
dataGridView1.DataSource ds.Tables["asientos"];

                        
dataGridView1.Columns["cuenta"].HeaderText "asientos.cuenta";
                        
dataGridView1.Columns["factura"].HeaderText "c_albven.factura";
                        
dataGridView1.Columns["cliente"].HeaderText "c_albven.cliente";
                        
dataGridView1.Columns["diferencia"].HeaderText "asientos.diferencia";
                        
dataGridView1.Columns["asientos.fecha"].HeaderText "asientos.fecha";
                        
dataGridView1.Columns["asientos.debe"].HeaderText "asientos.debe";
                        
dataGridView1.Columns["asientos.haber"].HeaderText "asientos.haber";
                        
cnn.Close();

                    }
                }


                catch (
Exception)
                {

                    
MessageBox.Show("jajajajaja");
                }
                
finally
                
{

                }

            }
        }
        private 
void Form1_Load(object senderEventArgs e)
        {

        }

       
        }

        
        
    }