Announcements Last Post
Announcement : Programming Students at UNISA School of Computing 06/19/2019 02:01PM
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
SQLDataSet
July 14, 2007 10:20PM
Hi, I'm wondering if anyone else is having the same problem I'm battling with now.

In the textbook on page 430, chapter 16, the book gives the code for the OnSHow event for the form, in it the 'dmoLibrary.sdsBook.CommandType := ctQuery' line gives me an Undeclared identifier: 'ctQuery' error.

I can't seem to get past this problem.

Any suggestions?
Re: SQLDataSet
July 15, 2007 10:11AM
Under "USES" in the UNIT add "SQLEXPR"..Hope this helps
Re: SQLDataSet
July 17, 2007 12:09AM
Thanks it worked.
Re: SQLDataSet
July 29, 2007 11:37AM
hi, I am having the same problem. I have added the SQLEXPR namespace (with and without all caps, does that make a difference?) and I am still stuck. I am using the version of delphi from unisa (ordered this year). Should there be a different namespace, the Borland.Vcl.SqlExpr is not helping at all either, it gives a 'cannot resolve unit name' error. Can anyone help?
Anonymous User
Re: SQLDataSet
August 23, 2007 09:45AM
I have a problem in setting the SQLDataSet. The problem is there is no command text displayed in the popup after selecting commanType as ctTable. As a result, I can not set active and couldn't proceed on chapter 15, database. Any help?
Re: SQLDataSet
August 23, 2007 09:05PM
hi tes

Not sure if this helps, but check that the properties of your SQLConnection are set properly (double click on the icon and click on the tick to test). If this is done then make sure that the SQLConnection property of your SQLDataSet is set to the same name as your data connection. If this is done and the SQLConnection is connected properly it may solve your problem.
Anonymous User
Re: SQLDataSet
August 27, 2007 09:33AM
Hi Morris,

Thank you for the advice. I tried it that way and still couldn't set the SQLDataSet property - may be due to inability to access the datatable (because in the CommandText nothing will be displayed). May be for your clear view, let me summarize my efforts.

I mannaged to get SQLConnection property successfuly by using dbxmys30.dll library name. For the VendorLib I have to include the path as follows - C:\Program Files\mysqlcc\LIBMYSQL.dll.

Next when I try to set the SQLDataSet property using the same connection, after selecting cttable for commandType, CommandText will not display anything. Please kindly help me for I couldn't proceed. Waiting for your reply.
Re: SQLDataSet
August 27, 2007 06:22PM
Ok, first the obvious... In MySQLcc, is the database containing the tables connected?

Is the database created correctly in MySQLcc, all the tables, fields etc?

Is the database name in the SQL Connection properties correct?

When setting up the SQL Connection, did you test the connection?

Sorry, that's all I could come up with.

I struggled for a while with user permissions in MySQLcc as well, luckily I got that sorted out...

Good luck smileys with beer
Re: SQLDataSet
August 27, 2007 07:11PM
hi tes

Don't know if you managed to sort out your problem yet, but if you haven't, check the setting of your Vendor Lib. If your installed MySql the standard way as per tut letter the path should be something like c:\mysql\bin\LIBMYSQL.dll

I think the dll file is part of mysql and not the control center (mysqlcc).
Hope this helps
Anonymous User
Re: SQLDataSet
August 28, 2007 09:08AM
Dear JohanSmal/Morris,

Thank you very much for the support. I tried all your suggestions repeatedly and couldn't succeed till now. I have no problem with the connection. I have also tried to use the path suggested by Morris. Still, the CommandText is empty and Active property in the SQLDataSet can not be set to true.

Yesterday, I received message from the school that the book is prepared before the latest release of delphi with Borlan Studio 2006. The schoolis also aware of the problem. Are you using the delphi version released with Borland Studio 2006? Now, I am on the verge of dropping my effort because I struggled for the whole month with no result. If you have any suggestion for Borland Studio 2006, please let me hear. I was so eager to work on the database part.

Thanks a million.
Re: SQLDataSet
August 28, 2007 07:19PM
hi tes

Sorry about your problem, I know how frustrating it can be. I am using Borland Studio 2006 and the only thing left that i can think of is to tell you all the settings I have for the various components for the example you are working on. This is what I do know: The SQLDataSet gets goes through the SQLConnection when it interacts with your actual database in MySql. When you set the property of CommandText in the DataSet you should have a drop down list of the tables in the database that is connected and active in MySql. If there is nothing in the drop down list then the connection of MySql to SQLConnection to SQLDataSet is wrong somewhere, the most likely places are the database itself or the SQLConnection. Open MySql control center and check if the cylinder shaped thing next to the name of your database is green (connected) and obviously if the robot at the bottom of your screen in green. If that is done, so far so good. Then in delphi make sure all the properties of your SQLConnection are properly set as per page 392 of textbook, except LibraryName should be dbxmys30.dll and VendorLib should be c:\mysql\bin\LIBMYSQL.dll (assuming mysql is on drive c and not in a another subfolder, etc). Then double click on the SQLConnection (scoMyVPLibrary or whatever) and make sure all the settings are as per page 392 of textbook. Click on the tick icon and if the popup dialog says successfully connected close the Connections editor and make sure that the connected property is set to true. If so, go to the DataSet and make sure that the settings for SQLCOnnection is the same name as your SQLConnection component. If all this is done without a problem then you should be able to see the tables you created in your database when you set the CommandText property, if not I am afraid I cannot think of what else the problem could be.

p.s. I cannot claim 100% certainty about what I have written, but hopefully it is mostly correct. Seeming as I also use Borland 2006 the only other way I can help is just repeat what settings I used for the same example, if you need let me know.

Morris
Anonymous User
Re: SQLDataSet
August 29, 2007 09:37AM
Hi Morris,

The connection is not successful when I use the path c:\mysql\bin\LIBMYSQL.dll, rather the following message popup:

dbExpress Error:[0x000c] Invalid username/password
Database server Error unknown MYSQL server Host 'DriverName'


Further when I right click on the green robot at the bottom right of the screen and click on show me,in MYODBC (environemnt), it said Driver 3.51 not found. Is that similar in yours?

I am very grateful for the support. Waiting your reply. Please kindly assit me to address the problem

Tes
Re: SQLDataSet
August 30, 2007 08:11AM
Hello

Indeed I have the same thing 'Driver 3.51 not found'. Not sure what this means, but I can use mysql without problems. As long as the light is green. As for the path for VendorLib, where have you installed mysql? I recommend doing it as per the instructions on the cd or tut letter. If not make sure that there is no space in the path name (i.e if it is in Program Files there may be a problem as opposed to Program_Files). Either way, I think that the path should point directly to the mysql\bin\LIBMYSQL.dll.

Which MySql did you install, 3.23.58 or 4.0.18? (The 4.0.18 is the correct one for delphi 2006).

What happened when you tested the connection in delphi? (This is not entirely foolproof it told me there was a successful connection when mysql was not running at all, and only raised an error when I tried to run the program)

The path you mentioned earlier 'C:\Program Files\mysqlcc\LIBMYSQL.dll' will proberbly not work, yet as the file name (LIBMYSQL.dll) is the one it is looking for an exception might not be raised. (Here I am in very much in educated guessing land) I suggest that you make sure the correct version of mysql is installed in the correct place and try the path c:\mysql\bin\LIBMYSQL.dll again.

Hope this helps
Morris
Anonymous User
Re: SQLDataSet
August 31, 2007 12:59PM
Dear Moris,

The version is 4.0.18 and I installed it from the CD sent by the school. My MySQL program is installed under C:\mysql. But still, I couldn't make the connection on C:\mysql\bin\LIBMYSQL.dll.

The connectio test says it is successfully connected.

But, it accepts when I use the path c:\Program Files\mysqlcc\LIBMYSQL.dll. The problem with this connectioon (using c:\Program Files\mysqlcc\LIBMYSQL.dll) is that the SQLDataSet Active property can not be set to true due to the CommandText is empty (with no table).

I have followed the text book strictly and tried 100 times. I couldn't concentrate on the other chapters. My mind is focusing on the database chapter. I will try it to reinstall mysql and give a trial during the weekend. For your information, even I installed delphi in another computer and tried it, but with no success. Sorry to bother you.

I will inform you the development by Monday. Bon weekend
Re: SQLDataSet
September 01, 2007 07:44AM
hi tes

I am hoping this is the problem as it shouldn't be to hard to sort out.
Both paths are valid, the file LIBMYSQL.dll exists in both c:\mysql\bin and in C:\Program Files\mysqlcc (on my computer at least). I am not sure if it is the same file or why the name is the same, but they do differ in size on my computer when I checked.

I tried using the path c:\Program Files\mysqlcc\LIBMQSQL.dll and I end up with the same problem you have at the moment, cannot select a table in CommandText yet the connection seems to be fine when I test it in the SQLConnections connection editor. By going back to c:\mysql\bin\LIBMYSQL.dll everything worked fine. Hopefully after re-installing mysql you come right.

Enjoy your weekend
Morris
Anonymous User
Re: SQLDataSet
September 03, 2007 08:01AM
Dear Morris,

I am very pleased to inform you that I sorted out the problem based on your advice. I started from scratch and checked every thing as per the text book. I think the problem was when I double click on the TSQLConnection to set the type of connection, the driver name was "DriverName" instead of "localhost". Sorry for my ignorance.

Now, I have successfully connect and set the SQLDataSet active property to true and proceed with the database without problem.I had lost hope and due to your encouragement, I am on the trcak at last. Really, I am indebted to you.

REally, I am most gratefull for your patience to assist me in sorting out the problem. Hope we will have communication in the future to learn from your expertise. I am from Ethiopia. my mail is tesfayebed@yahoo.com. I would be happy to share your expertise more.

Thanks a million

Tes
Re: SQLDataSet
September 03, 2007 05:43PM
hey tes

I am so glad you were successful, glad I could help. I have been through the same thing before with another module (COS112) and I know the feeling of frustration. Enjoy the database section, much more fun than the rest. I wouldn't bank on my expertise, but I will gladly help if I can, either here or via email (my address is joyner.michael@gmail.com).

Have a good day
Morris
Sorry, only registered users may post in this forum.

Click here to login