Recent

Author Topic: Problems with Dbgrid? how I see my table B.C.  (Read 8088 times)

BlackCat

  • New member
  • *
  • Posts: 9
Problems with Dbgrid? how I see my table B.C.
« on: May 07, 2008, 09:18:12 pm »
Hi, I have a big problem, because, Ican't see my sql table in the DbGrid.
I change this properties and don't happened nothing in my dbgrid:

in mysqlconnection.connected= "true" don't allow me change to TRUE..
I included in a botton and also directly in the component

sqlquery.sql.text:='select * from my_table'
sqlquery.open; // is the same if I use sqlquery.execsql??

considering all my componets to enabled the connection
my problem is that datasource I can't see my table

I saw that I need use sqlquery.active:=true; to activate the sql instruction in my dbgrid..

What's wrong????

Can somebody help me??
If you have an EXCELLENT manual "how to use databases component"  it's really wonderfull to me


thanks a lot...BlackCat from  Slp,Mexico
[/code][/list]

petrut

  • Newbie
  • Posts: 1
Problems with Dbgrid? how I see my table B.C.
« Reply #1 on: May 12, 2008, 08:06:29 am »
Hi,

send me please a personal email :  petrut at wanadoo dot fr

I will send you a tutorial about the connection to firebird using zeos components

bye

BlackCat

  • New member
  • *
  • Posts: 9
Problems with Dbgrid? how I see my table B.C.
« Reply #2 on: May 12, 2008, 07:38:25 pm »
I Send you a email, checks this one please

OnixJr

  • Full Member
  • ***
  • Posts: 172
    • http://www.brlazarus.kit.net
Problems with Dbgrid? how I see my table B.C.
« Reply #3 on: May 17, 2008, 04:28:46 pm »
Quote
I will send you a tutorial about the connection to firebird using zeos components


Why not publish it on Lazarus wiki?

Regards,
Júnior
Portal Lazarus Brasil - http://lazaruspascal.codigolivre.org.br/portal.php
Lazarus BOOK (in portuguese) - http://lazarus-book.blogspot.com
<hipernetjr@yahoo.com.br> - Curitiba/Brazil

BlackCat

  • New member
  • *
  • Posts: 9
Problems with Dbgrid? how I see my table B.C.
« Reply #4 on: May 23, 2008, 12:27:52 am »
Quote from: "BlackCat"
I Send you a email, checks this one please


Thanks for your reply :D , but i'm just working with MYSQL, and is very different ways to connect one and the other

Finally I change this in my small application and is working now..!!

In the  SqlQuery I changes this values in Properties:

Database:my_sqlConnection
DAtasource:(none)
Transaction:my_SqlTransaction

then, I use a botton and add sqlquery1.Active:=true; and then It shows my table the first time, but when I click again, It shows me this mesagge:
"Operation cannot be performed on an active Dataset"
then I modify
Code: [Select]

//to show table in the dbgrid
sqlquery1.Active:=true;
showmessage('hi');// to break for a moment and experiment with the next instruction
sqlquery1.close;            

 but when "I aceppt" the show message my information in the DbGrid dissapeared, but when I click the botton again the message:"Op...Dataset" not happend..

1.
Why?  Can somebody Explain what about SqlQuery (in the properties:.active, sql.text, .open, .close)   functions  ????
It's so complicated..! :roll:
Sorry for my bad English.. :oops:

2.
And other question, I check the forum in "Database" Section but I don't know when the Lazarus 0.9.24 is working , because the first post about "Databases" -since  recient post 2008 to january 2006- cann't give it me answers, because maybe this componentes change in the first version or maybe doesn't exist yet..

Gracias...!  BlackCat

sakuragi

  • New member
  • *
  • Posts: 6
    • http://www.sakux.com
Problems with Dbgrid? how I see my table B.C.
« Reply #5 on: June 24, 2008, 10:42:37 pm »
Hola blackcat, ya pudiste solucionar el problema, yo tengo el mismo problema, no me sale el resultado de la consulta en el DBgrid,

si es posible, comparte la solucion.

saludos

gracias

BlackCat

  • New member
  • *
  • Posts: 9
Try change this..!
« Reply #6 on: July 05, 2008, 09:29:11 am »
Quote from: "sakuragi"

si es posible, comparte la solucion.

The solution for me was:
change in PROPERTIES of the componets:
In the SqlQuery1 I changes this values in Properties:
   {this}
   SqlQuery1.Datasource:=(none)<-
                  .Database:=my_sqlConnection
                  .Datasource:=(none) <-
                  .Transaction:=my_SqlTransaction
   {/this}

then, in the

   dbgrid.datasource:=datasource1;<-
   datasource1.dataset:=sqlQuery1;<-

when you are searching (with Select SQL instruction) datas in your table:

   SQLQuery1.SQL.Text:='Select (fields) from (table):'
   SQLQuery1.Open;

It's working now..!!But when I use "update", "Insert" ...I need change:

Datasource1.dataset:my_SqlQuery1; <-

When i Insert, or Update SQL instructionfor a   data in my table I use .Add:

   SqlQuery1.SQL.Add('Insert into (table) values (my_values)');
   SQLQuery1.EXECSQL;

You need check, because I use the same DATAMODULE for Insert,Update, Select SQL instructions, and I change the values.. in my datasource, etc.
Ok.
You catch them?

But when I use for example
Firstly     SQLQuery.text("select .........";);
              SQLQuery.Open;
              {here***}
Secondly SQLQuery.text("select ....te same or other ...";);
              SQLQuery.Open;
This error shows "Can't be worked in a Active Dataset" I add in
{here***}= SQLQuery1.close;
But I lost the my datas from the "Firstly",... When I  OPEN  inmediately I CLOSE the SqlQuery...If you found the ANSWER  to use OPEN-CLOSE, posted it please....!


Saludos..

 

TinyPortal © 2005-2018