Codigo enc# de mucha ayuda
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
usingSystem.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WinWorksdll
{
public partial class Form1 : Form
{
public Form1()
{InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ClassConectDB.ClassConectSQL _classSQL = new ClassConectDB.ClassConectSQL();String _opcion=_classSQL.ValidaConnSQL();
if (_opcion == null)
{
MessageBox.Show("Conexion Abierta");
}
else
{MessageBox.Show("Error" + _opcion);
}
}
private void button2_Click(object sender, EventArgs e)
{
ClassConectDB.ClassConectSQL_classData = new ClassConectDB.ClassConectSQL();
//DataSet _ds1 = new DataSet();
DataSet ds1 = _classData.DsSQL("select * from Vw_ProductxLocation");this.dataGrid1.DataSource = ds1.Tables[0].DefaultView;
}
private void dataGrid1_Navigate(object sender, NavigateEventArgs ne)
{
}
private voidbutton3_Click(object sender, EventArgs e)
{
string _sql = "select year(OrderDate) as AnioOrder, SalesOrderID from Sales.SalesOrderHeader";
ClassConectDB.ClassConectSQL_classSql = new ClassConectDB.ClassConectSQL();
DataSet _dsAxO = _classSql.DsSQL(_sql);
this.cmbaño.DataSource = _dsAxO.Tables[0].DefaultView;this.cmbaño.DisplayMember = "AnioOrder";
this.cmbaño.ValueMember = "SalesOrderID";
}
private void cmbaño_SelectedIndexChanged(object sender, EventArgs e)
{...
Regístrate para leer el documento completo.