Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > C++ Builder
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 10-05-2012
ErYcK ErYcK is offline
Miembro
NULL
 
Registrado: abr 2012
Posts: 26
Poder: 0
ErYcK Va por buen camino
Dataset not in edit or insert mode

Buenas a todos, mi problema es el siguiente:
Trabajo con c++ Builder 6 y Access 2007
Mi aplicación se encarga de cargar un archivo .csv en un StringGrid mediante un boton al que llamo Importar, hasta ahi todo bien, una vez cargado este archivo, intento que los datos de este StringGrid se guarden en la base de datos que tengo en acces lo hago de la siguiente forma:

Código:
XDatos->TCategorias->Open();

        XDatos->TSubCat1->Open();

        XDatos->TSubCat2->Open();

        XDatos->TSubCat3->Open();

        XDatos->TMarcas->Open();


        XDatos->TCaracteristicas->Open();

        for (int f=1;f<=StringGrid1->RowCount;f++)
        {

                if (StringGrid1->Cells[0][f]!="")
                {

                        XDatos->QProductos->Append();
                        XDatos->QProductosREFERENCIA->Value = StringGrid1->Cells[0][f];
                        XDatos->QProductosESTADO->Value = StringGrid1->Cells[1][f];
                        //XDatos->QProductosCATEGORIA->Value = StringGrid1->Cells[2][f];
                        bool esta=false;
                        while(!XDatos->TCategorias->Eof)
                        {
                                if (StringGrid1->Cells[2][f] == XDatos->TCategoriasCATEGORIA->Value)
                                {
                                        XDatos->QProductosCATEGORIA->Value=XDatos->TCategoriasCodCategoria->Value;
                                        esta=true;
                                }
                                XDatos->TCategorias->Next();
                        }
                        if (!esta)
                        {
                                XDatos->TCategorias->Append();
                                XDatos->TCategoriasCATEGORIA->Value = StringGrid1->Cells[2][f];
                                XDatos->QProductosCATEGORIA->Value=XDatos->TCategoriasCodCategoria->Value;
                                XDatos->TCategorias->Post();

                        }
                        //XDatos->QProductosSUBCAT1->Value = StringGrid1->Cells[3][f];
                        esta=false;
                        while(!XDatos->TSubCat1->Eof)
                        {
                                if (XDatos->TSubCat1CATEGORIA->Value == XDatos->QProductosCATEGORIA->Value && XDatos->TSubCat1SUBCAT1->Value == StringGrid1->Cells[3][f])
                                {
                                        XDatos->QProductosSUBCAT1->Value= XDatos->TSubCat1CodSUBCAT1->Value;
                                        esta=true;
                                }
                                XDatos->TSubCat1->Next();
                        }
                        if (!esta)
                        {


                                //XDatos->TSubCat1CodSUBCAT1->Value = XDatos->QProductosSUBCAT1->Value;
                                XDatos->TSubCat1->Append();
                                XDatos->TSubCat1SUBCAT1->Value = StringGrid1->Cells[3][f];
                                XDatos->TSubCat1CATEGORIA->Value = XDatos->QProductosCATEGORIA->Value;
                                XDatos->QProductosSUBCAT1->Value= XDatos->TSubCat1CodSUBCAT1->Value;
                                XDatos->TSubCat1->Post();

                        }
                        //XDatos->QProductosSUBCAT2->Value = StringGrid1->Cells[4][f];
                        esta=false;
                        while(!XDatos->TSubCat2->Eof)
                        {
                                if (XDatos->TSubCat2SUBCAT1->Value == XDatos->QProductosSUBCAT1->Value && XDatos->TSubCat2SUBCAT2->Value == StringGrid1->Cells[4][f])
                                {
                                        XDatos->QProductosSUBCAT2->Value = XDatos->TSubCat2CodSUBCAT2->Value;
                                        esta=true;
                                }
                                XDatos->TSubCat2->Next();
                        }
                        if (!esta)
                        {


                                //XDatos->TSubCat2CodSUBCAT2->Value = XDatos->QProductosSUBCAT2->Value;
                                XDatos->TSubCat2->Append();
                                XDatos->TSubCat2SUBCAT2->Value = StringGrid1->Cells[4][f];
                                XDatos->TSubCat2SUBCAT1->Value = XDatos->QProductosSUBCAT1->Value;
                                XDatos->QProductosSUBCAT2->Value = XDatos->TSubCat2CodSUBCAT2->Value;
                                XDatos->TSubCat2->Post();
                        }
                        //XDatos->QProductosSUBCAT3->Value = StringGrid1->Cells[5][f];
                        esta=false;
                        while(!XDatos->TSubCat3->Eof)
                        {
                                if (XDatos->TSubCat3SUBCAT2->Value == XDatos->QProductosSUBCAT2->Value && XDatos->TSubCat3SUBCAT3->Value == StringGrid1->Cells[5][f])
                                {
                                        XDatos->QProductosSUBCAT3->Value = XDatos->TSubCat3CodSUBCAT3->Value;
                                        esta=true;
                                }
                                XDatos->TSubCat3->Next();
                        }
                        if (!esta)
                        {


                                //XDatos->TSubCat3CodSUBCAT3->Value = XDatos->QProductosSUBCAT3->Value;
                                XDatos->TSubCat3->Append();
                                XDatos->TSubCat3SUBCAT3->Value = StringGrid1->Cells[5][f];
                                XDatos->TSubCat3SUBCAT2->Value = XDatos->QProductosSUBCAT2->Value;
                                XDatos->QProductosSUBCAT3->Value = XDatos->TSubCat3CodSUBCAT3->Value;
                                XDatos->TSubCat3->Post();
                        }
                        XDatos->QProductosPRODUCTO->Value = StringGrid1->Cells[6][f];
                        XDatos->QProductosKEY->Value = StringGrid1->Cells[7][f];
                        XDatos->QProductosMARCA->Value = StringGrid1->Cells[8][f];
                        esta=false;
                        while(!XDatos->TMarcas->Eof)
                        {
                                if (XDatos->TMarcasMARCA->Value == XDatos->QProductosMARCA->Value)
                                        esta=true;
                                XDatos->TMarcas->Next();
                        }
                        if (!esta)
                        {
                                XDatos->TMarcas->Append();
                                XDatos->TMarcasMARCA->Value = XDatos->QProductosMARCA->Value;
                                XDatos->TMarcas->Post();
                        }
                        XDatos->QProductosDESCRIPCION->Value = StringGrid1->Cells[9][f];
                        XDatos->QProductosCATEGORIAX->Value = StringGrid1->Cells[10][f];
                        XDatos->QProductosCATEGORIAS->Value = StringGrid1->Cells[11][f];
                        XDatos->QProductos->Post();
                        for(int c=12;c<=StringGrid1->ColCount;c++)
                        {
                                if (StringGrid1->Cells[c][f]!="")
                                {
                                        XDatos->TCaracteristicas->Append();
                                        XDatos->TCaracteristicasLuCATEGORIA->Value = StringGrid1->Cells[2][f];
                                        XDatos->TCaracteristicasLuSUBCAT1->Value = StringGrid1->Cells[3][f];
                                        XDatos->TCaracteristicasLuSUBCAT2->Value = StringGrid1->Cells[4][f];
                                        XDatos->TCaracteristicasLuSUBCAT3->Value = StringGrid1->Cells[5][f];
                                        XDatos->TCaracteristicasref->Value = StringGrid1->Cells[0][f];
                                        if (c % 2 ==0)
                                                XDatos->TCaracteristicasCARACTERISTICA->Value = StringGrid1->Cells[c][f];
                                        else
                                                XDatos->TCaracteristicasVALOR->Value = StringGrid1->Cells[c][f];

                                        XDatos->TCaracteristicas->Post();
                                }
                        }
                }
        }
Compilar compila bien, el problema es que cuando le doy a importar, me salta el error diciéndome que el dataset no esta en edit o insert mode lo cual no entiendo, ya que antes de asignarle valores pongo el
XDatos->TCategoria->Append();.

Espero que haya quedado claro el problema, si alguien tiene alguna idea sobre que puede pasar, o a alguien le ha pasado algo parecido agradecería la ayuda.

Gracias de ante mano.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Error "DatAset not in edit or intert mode" ESTANDO EN MODO INSERT!!! Lenny Varios 17 24-05-2011 20:16:34
DataSet not in edit or insert mode Mystery Varios 2 09-06-2010 17:40:17
Dataset not in edit or insert Mode radge OOP 1 10-06-2008 15:46:32
Dataset not in edit or insert mode :S si esta en append! Mannu C++ Builder 1 28-11-2007 09:52:18
ayuda novata: "Dataset not in Edit or Insert mode" maquicu Tablas planas 1 05-06-2004 09:40:27


La franja horaria es GMT +2. Ahora son las 03:13:18.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi