|
List Info
Thread: Re: aplication ado.net
|
|
| Re: aplication ado.net |

|
2008-02-24 08:11:42 |
|
That's a lot of code to look at.
Show us where you're trying to select or getvalue the data.
If you're saying data is not displaying in your dataGridView items, then I suspect you're missing a call to .DataBind()
On 2/23/08, dhpacheco < denishernandezpacheco gmail.com">denishernandezpacheco gmail.com> wrote:
Hello I'm doing an application using VS 2005, c# for management a DB, but I new using the language, neither have experience in programming. Please could someone tell me if this is correct? I include a datase in my project and create variables tableadapter for
each table of the dataset. Now I need operate the DB, using insertions is easy 'cause the designer creates the storage procedures, but I need to get values of the BD. I thought that an option was to use Dataset variables so that
alter using selects could get a copy under which to obtain datas, but don't know how to access a method getvalue (or something like that), I need to use storage procedures that return scalar values, I'm using
some but that return datasets, but have problems with variables. I attach the code for recomendations. Thanks for your time. namespace Registro { public partial class Form1 : Form { private HojaFirmaTableAdapter HojaFirma = new HojaFirmaTableAdapter();
private InstitucionTableAdapter Institucion = new InstitucionTableAdapter(); private TrabajadorTableAdapter Trabajador = new TrabajadorTableAdapter(); private SesionesTableAdapter Sesiones = new SesionesTableAdapter();
private DateTime dmahmsg; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.hojaFirmaTableAdapter.Fill(this.registroDataSet1.HojaFirma);
// TODO: esta línea de código carga datos en la tabla 'registroDataSet.HojaFirma39; Puede moverla o quitarla según sea necesario. registroDataSet1.EnforceConstraints = false; dataGridView1.DataSource = HojaFirma.GetData(); // show HojaFirma
table dataGridView2.DataSource = Institucion.GetData();//show Institucion // table } private void button1_Click(object sender, EventArgs e)
{ string cbi = textBox1.Text; // Gets the code barr Int64 cb = Convert.ToInt64(cbi); // converts the code to put it in the //DB DataTable ndt = new DataTable(); // Creates a new DataTable variable
ndt = Trabajador.GetDataBy(cb); // GetDataBy is a storage proc. that //returns a DataTable with the code // entered if it exist in the BD
int endt = ndt.Rows.Count; // endt returns the estate of the DataTable //(empty or not) if (endt == 0) { MessageBox.Show("Worker not registered in Data Base");
} else if (endt == 1) // Worker registered { DataTable ndt1 = new DataTable(); // Creates a new DataTable variable // Sesion de entrada 1 if (dmahmsg.TimeOfDay >= new TimeSpan(8, 30, 0) && dmahmsg.TimeOfDay
<= new TimeSpan(11, 30, 0)) { MessageBox.Show("Sesion de entrada 1"); } // Sesion de entrada 2 else if (dmahmsg.TimeOfDay >= new TimeSpan(13, 30, 0) && dmahmsg.TimeOfDay <= new TimeSpan(17, 0, 0))
{ MessageBox.Show("Sesion de entrada 2"); } DateTime fecha = dmahmsg; DateTime sesionent1 = dmahmsg; DateTime sesionsal1 = dmahmsg; DateTime sesionent2 = dmahmsg; DateTime sesionsal2 = dmahmsg;
DateTime sesionextent = dmahmsg; DateTime sesionextsal = dmahmsg; int cod_aus = 14; int h_ause = 5; int ext = 2; string obs = "denis"; int inst = 1; HojaFirma.InsertarTrabajador(cb, fecha, sesionent1, sesionsal1,
sesionent2,sesionsal2, sesionextent, sesionexts | |