SoloCodigo
Programación General => C/C++ => C++ Builder => Mensaje iniciado por: Sagma en Martes 24 de Mayo de 2005, 18:44
-
Hola a todos he seguido, lo que dicen en este
Primeros Pasos (http://foros.solocodigo.com/index.php?showtopic=15109)
Pero aùn me sigue dando este error que muestro, son cuatro campos que uso y es en access, por supuesto que el primer campo es la llave.
Me pueden ayudar, mil gracias
-
agregale algo como esto para restringir los datos nulos.
if (Edit1->Text.Trim()!=""&&Edit2->Text.Trim()!="")
si no puedes mandame el codigo y te le arreglo.
-
Gracias muno por tu interes, pero dime a donde te lo envio?? :whistling:
he puesto :rolleyes:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("select * from persona");
ADOQuery1->Open();
if (Edit1->Text.Trim()!=""&&Edit2->Text.Trim()!=""&&Edit3->Text.Trim()!=""&&Edit4->Text.Trim()!="")
{
ADOQuery1->Append();
ADOQuery1->FieldByName("registro")->AsString=Edit1->Text;
ADOQuery1->FieldByName("nombres")->AsString=Edit2->Text;
ADOQuery1->FieldByName("apellido1")->AsString=Edit3->Text;
ADOQuery1->FieldByName("apellido2")->AsString=Edit4->Text;
ADOQuery1->Post();
Edit1->Clear();
Edit2->Clear();
Edit3->Clear();
Edit4->Clear();
} else ShowMessage("Falta informacion");
}
//---------------------------------------------------------------------------
gracias :D
-
Gracias muno por tu interes, pero dime a donde te lo envio?? :whistling:
he puesto :rolleyes:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("select * from persona");
ADOQuery1->Open();
if (Edit1->Text.Trim()!=""&&Edit2->Text.Trim()!=""&&Edit3->Text.Trim()!=""&&Edit4->Text.Trim()!="")
{
ADOQuery1->Append();
ADOQuery1->FieldByName("registro")->AsString=Edit1->Text;
ADOQuery1->FieldByName("nombres")->AsString=Edit2->Text;
ADOQuery1->FieldByName("apellido1")->AsString=Edit3->Text;
ADOQuery1->FieldByName("apellido2")->AsString=Edit4->Text;
ADOQuery1->Post();
Edit1->Clear();
Edit2->Clear();
Edit3->Clear();
Edit4->Clear();
} else ShowMessage("Falta informacion");
}
//---------------------------------------------------------------------------
gracias :D
-
Gracias muno por tu interes, pero dime a donde te lo envio?? :whistling:
he puesto :rolleyes:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("select * from persona");
ADOQuery1->Open();
if (Edit1->Text.Trim()!=""&&Edit2->Text.Trim()!=""&&Edit3->Text.Trim()!=""&&Edit4->Text.Trim()!="")
{
ADOQuery1->Append();
ADOQuery1->FieldByName("registro")->AsString=Edit1->Text;
ADOQuery1->FieldByName("nombres")->AsString=Edit2->Text;
ADOQuery1->FieldByName("apellido1")->AsString=Edit3->Text;
ADOQuery1->FieldByName("apellido2")->AsString=Edit4->Text;
ADOQuery1->Post();
Edit1->Clear();
Edit2->Clear();
Edit3->Clear();
Edit4->Clear();
} else ShowMessage("Falta informacion");
}
//---------------------------------------------------------------------------
gracias :D
-
Gracias muno por tu interes, pero dime a donde te lo envio?? :whistling:
he puesto :rolleyes:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("select * from persona");
ADOQuery1->Open();
if (Edit1->Text.Trim()!=""&&Edit2->Text.Trim()!=""&&Edit3->Text.Trim()!=""&&Edit4->Text.Trim()!="")
{
ADOQuery1->Append();
ADOQuery1->FieldByName("registro")->AsString=Edit1->Text;
ADOQuery1->FieldByName("nombres")->AsString=Edit2->Text;
ADOQuery1->FieldByName("apellido1")->AsString=Edit3->Text;
ADOQuery1->FieldByName("apellido2")->AsString=Edit4->Text;
ADOQuery1->Post();
Edit1->Clear();
Edit2->Clear();
Edit3->Clear();
Edit4->Clear();
} else ShowMessage("Falta informacion");
}
//---------------------------------------------------------------------------
gracias :D
-
Gracias muno por tu interes, pero dime a donde te lo envio?? :whistling:
he puesto :rolleyes:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("select * from persona");
ADOQuery1->Open();
if (Edit1->Text.Trim()!=""&&Edit2->Text.Trim()!=""&&Edit3->Text.Trim()!=""&&Edit4->Text.Trim()!="")
{
ADOQuery1->Append();
ADOQuery1->FieldByName("registro")->AsString=Edit1->Text;
ADOQuery1->FieldByName("nombres")->AsString=Edit2->Text;
ADOQuery1->FieldByName("apellido1")->AsString=Edit3->Text;
ADOQuery1->FieldByName("apellido2")->AsString=Edit4->Text;
ADOQuery1->Post();
Edit1->Clear();
Edit2->Clear();
Edit3->Clear();
Edit4->Clear();
} else ShowMessage("Falta informacion");
}
//---------------------------------------------------------------------------
gracias :D
-
Gracias muno por tu interes, pero dime a donde te lo envio?? :whistling:
he puesto :rolleyes:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("select * from persona");
ADOQuery1->Open();
if (Edit1->Text.Trim()!=""&&Edit2->Text.Trim()!=""&&Edit3->Text.Trim()!=""&&Edit4->Text.Trim()!="")
{
ADOQuery1->Append();
ADOQuery1->FieldByName("registro")->AsString=Edit1->Text;
ADOQuery1->FieldByName("nombres")->AsString=Edit2->Text;
ADOQuery1->FieldByName("apellido1")->AsString=Edit3->Text;
ADOQuery1->FieldByName("apellido2")->AsString=Edit4->Text;
ADOQuery1->Post();
Edit1->Clear();
Edit2->Clear();
Edit3->Clear();
Edit4->Clear();
} else ShowMessage("Falta informacion");
}
//---------------------------------------------------------------------------
gracias :D
-
mire estimado.
revise su programa y esta bien.
funciona.
no se que tipo de base de datos estas trabajando pero si es con Access,
revisa la tabla persona, ya que a los mejor cuando la creaste, sin darte cuenta
se te agrego un campo primario (Id) que no lo tenias considerado, si es asi.
avisame de lo contrario seguimos con la conversa.
-
Gracias, en primer lugar quiero pedir disculpas, pero no se que paso, envie el mensaje y me dio un error NetWork Error (tcp_error), y weno ahi estan los mensajes copiados, :blink:
Muno, gracias, pero tengo esta tabla que te lo muestro, y como dices solo tengo un campo que es unico. :whistling: