
17/01/2011, 16:36
|
 | | | Fecha de Ingreso: septiembre-2008
Mensajes: 152
Antigüedad: 16 años, 6 meses Puntos: 0 | |
Respuesta: Visual Studio 2008 c# Cita:
Iniciado por alberto_gc hol que tal buen dia tengan todos, pues aqui de nuevo preguntando sobre un errror de c# y lo manejo con visual estudio 2008 el codigo lo que hace es una simulacion de acuario en el cual inserta modifica borra y muestra, aja el insertar lo hace pero al momento de darle en modificar borrrar y mostrar me manda un error..
Este es mi codigo:
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;
namespace windowsformsapplication2
{
public partial class form4 : Form
{
public form4()
{
initializecomponent();
}
private void form4_load(object sender, eventargs e)
{
oledbdataadapter1.fill(dataset11);
oledbdataadapter2.fill(dataset11);
}
private void oledbconnection1_infomessage(object sender, system.data.oledb.oledbinfomessageeventargs e)
{
}
private void button1_click(object sender, eventargs e)-->este es insertar
{
oledbcommand1.parameters[0].value = textbox1.text;
oledbcommand1.parameters[1].value = textbox2.text;
oledbcommand1.parameters[2].value = textbox3.text;
oledbcommand1.parameters[3].value = textbox4.text;
oledbcommand1.parameters[4].value = listbox3.text;
oledbcommand1.parameters[5].value = listbox1.text;
oledbconnection1.open();
try
{
oledbcommand1.executenonquery();
}
catch (exception)
{
messagebox.show("ocurrio un error");
}
oledbconnection1.close();
}
private void button2_click(object sender, eventargs e)este es borrar-->
{
oledbcommand2.parameters[0].value = textbox1.text;
oledbconnection1.open();
try
{
oledbcommand2.executenonquery();
}
catch (exception)
{
messagebox.show(" a ocurridoun error");
}
oledbconnection1.close();
}
private void button3_click(object sender, eventargs e)-->este es modificar
{
oledbcommand3.parameters[0].value = textbox2.text;
oledbcommand3.parameters[1].value = textbox3.text;
oledbcommand3.parameters[2].value = textbox4.text;
oledbcommand3.parameters[3].value = textbox1.text;
oledbconnection1.open();
try
{
oledbcommand3.executenonquery();
}
catch (exception)
{
messagebox.show(" a ocurridoun error");
}
oledbconnection1.close();
}
private void button4_click(object sender, eventargs e)
{
dataset21.clear();
oledbdataadapter4.selectcommand.parameters[0].value = textbox1.text;
oledbdataadapter4.fill(dataset21);
}
}
} perdon pero esq como fue examen fue de rapido
__________________ Si el mañana llegara, yo seria el hombre mas billonario del mundo XD....
Última edición por alberto_gc; 17/01/2011 a las 16:38
Razón: ME FALTO ESPECIFICAR
|