Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
using System;
using System.Collections.Generic;
using System.Text;
using IBM.Data.Informix;
using System.Data;
namespace Lib_datos
{
public class producto_ifx
{
public DataSet conproducto(int cdgo_prdcto)
{
DataSet ds = new DataSet();
IfxParameter pcdgo_prdcto = new IfxParameter();
pcdgo_prdcto.IfxType = IfxType.Integer;
pcdgo_prdcto.ParameterName= "@cdgo_prdcto";
pcdgo_prdcto.Direction= ParameterDirection.Input;
pcdgo_prdcto.Value = cdgo_prdcto;
IfxConnection ifxcon = new IfxConnection("Host=marusr; Service=curs
; Server=marusr_shm; Database= mrion ; User Id=as ; Password=3bces; ");
ifxcon.Open();
IfxCommand ifxcomm = new IfxCommand();
ifxcomm.Connection = ifxcon;
ifxcomm.Parameters.Add(pcdgo_prdcto);
ifxcomm.CommandText = " select * from prdcto where cdgo_prdcto =?";
IfxDataAdapter ifxadapter = new IfxDataAdapter(ifxcomm);
try
{
ifxadapter.Fill(ds);
//ifxcomm.ExecuteNonQuery();
}
catch (Exception ex)
{
}
finally
{
ifxcon.Close();
}
return ds;
}
}
}
Se invoca desde una forma la clase anterior
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Lib_datos;
namespace clase1
{
public partial class frm_buscar_producto : Form
{
OpenFileDialog objopen = new OpenFileDialog();
public string strimagen;
public frm_buscar_producto()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
producto_ifx obj_prdcto = new producto_ifx();
objopen.Title = "Seleccione el archivo";
objopen.Filter = "text files(*.jpg)|*.jpg";
if (objopen.ShowDialog() == DialogResult.OK)
{
System.IO.FileInfo objinfo = new System.IO.FileInfo(objopen.File
Name);
strimagen = objinfo.Name;
string[] tmp = strimagen.Split('.');
strimagen = tmp[0];
DataSet dsproductos;
dsproductos=obj_prdcto.conproducto(int.Parse(strimagen));
//Aqui se invoca la clase
txt_nmbre.Text = dsproductos.Tables[0].Rows[0]["nmbre_prdcto"].T
oString();
txt_cdgo.Text = dsproductos.Tables[0].Rows[0]["cdgo_prdcto"].ToS
tring();
txt_iva.Text = dsproductos.Tables[0].Rows[0]["iva"].ToString();
}
}
}
}
ds_infoplano.WriteXml(@"d:\adri\prueba.xml");
}
}
}
Manejar una Fecha
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(dtm_fcha_i.Value.Day.ToString());
MessageBox.Show(dtm_fcha_i.Value.Month.ToString());
MessageBox.Show(dtm_fcha_i.Value.Year.ToString());
}