::::::::::::C# ::::::::::::
ESPESAREMOS A USAR EL LENGUAJE DE PROGRAMACIÓN " C# " DESDE LO MAS BÁSICO, HASTA PODER CREAR PROYECTOS COMPLEJOS
::::: GNU-LINUX-CENTOS :::::
CONOSCAMOS UN SERVIDOR GNU-LINUX-CENTOS DESDE 0 HASTA LA ALTURA DE UN SERVIDOR
DNS EN GNU-LINUX-CENTOS
DNS EN GNU-LINUX-CENTOS
::::: ENSAMBLAJE DE PCs :::::
::::: UML :::::
::::: REDES :::::
::::: ORACLE 10g :::::
============ eventos del datagridview ===============================================
ResponderEliminarprivate void dg_cliente_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
// fila seleccionda
int fila = this.dg_cliente.CurrentCell.RowIndex;
// codigo del clietne
string cocli = dg_cliente[0, fila].Value.ToString();
string cadsql = "select OrderID from dbo.Orders where CustomerID='" + cocli + "'";
SqlDataReader dr = cl.leereg(cadsql);
this.lbx_pedidos.Items.Clear(); //limpiar la lista
// comiensa la lectura
while(dr.Read())
{
lbx_pedidos.Items.Add(dr[0].ToString());
}
dr.Close();
}
private void dg_cliente_KeyDown(object sender, KeyEventArgs e)
{ // programar las teclas flecha arriva y flecha abajo
if (e.KeyCode == Keys.Down || e.KeyCode == Keys.Up)
{
dg_cliente_CellContentClick(sender, null);
}
}
===========================================================
::::::::::::::::::::::::::::
ResponderEliminarrectificando el cpmentario anterior
::::::::::::::::::::::::::::::
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace primero
{
public partial class Form1 : Form
{
Class1 cl = new Class1();
public Form1()
{
InitializeComponent();
}
private void txt_cliente_TextChanged(object sender, EventArgs e)
{
//cuando se ingrese algun va,lor en el texto
if (txt_cliente.Text.Length > 1)
{
string cad = "select CustomerID,CompanyName from dbo.Customers where ContactName like '" + this.txt_cliente.Text.Trim() + "%'";
this.dg_cliente.DataSource = cl.runsql(cad);
txt_cliente.Text = "";
txt_cliente.Focus();
}else{
string cad = "select CustomerID,CompanyName from dbo.Customers where ContactName like '" + this.txt_cliente.Text.Trim() + "%'";
this.dg_cliente.DataSource = cl.runsql(cad);
}
}
private void dg_cliente_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
// fila seleccionda
int fila = this.dg_cliente.CurrentCell.RowIndex;
// codigo del clietne
string cocli = dg_cliente[0, fila].Value.ToString();
string cadsql = "select OrderID from dbo.Orders where CustomerID='" + cocli + "'";
SqlDataReader dr = cl.leereg(cadsql);
this.lbx_pedidos.Items.Clear(); //limpiar la lista
// comiensa la lectura
while(dr.Read())
{
lbx_pedidos.Items.Add(dr[0].ToString());
}
dr.Close();
}
private void dg_cliente_KeyDown(object sender, KeyEventArgs e)
{ // programar las teclas flecha arriva y flecha abajo
if (e.KeyCode == Keys.Down || e.KeyCode == Keys.Up)
{
dg_cliente_CellContentClick(sender, null);
}
}
private void lbx_pedidos_SelectedIndexChanged(object sender, EventArgs e)
{
string pedido = lbx_pedidos.Text;
//string sql = "";
}
// select CustomerID,CompanyName from dbo.Customers where ContactName like'd%'
//select OrderID from dbo.Orders where CustomerID='d'
//create procedure spdetalle
//@ped int
//as
//select a.ProductID,producname,b.UnitPrice,Quantity,b.UnitPrice*Quantity as total
//from Products a, [Order Details] b
//where a.
}
}