April 18, 2024, 04:07:15 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Database program with 3 tables

Started by Brian, April 04, 2007, 01:17:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Brian

Hi,

I've been working on this for a while, and certain features are not finished yet: Printing is yet to be done, and some kind of preferences dialog still to do

Compiles as a project. Some of the data in the mdb is valid, so don't go ringing 'em up!

When loaded, right click on either listview for more options; double-click a listview item to edit that item

Find button works, as do Next, Previous and Update

I have probably done it all wrong, but it works, and I'm happy, so if anyone gives it a once-over, and sees anything glaringly bad, please let me know

Note: Needs Fletchie's ctl pack files

Thanks,

Brian

peterpuk

April 04, 2007, 09:42:18 PM #1 Last Edit: April 05, 2007, 01:02:38 AM by peterpuk
Good to see you are progressing with your project...takes a lot of time , doesn't it :)

I will be sure to have a look at how it all hangs together.

I noticed that when you add a title (right click the titles listview), the combobox is filled with duplicate title names. If this is not what you want, I have re-coded the routine to check for duplicates. The idea is to sort the recordset (ORDER BY titles), then compare the current title with the lastTitle read before adding to the combobox.

   CASE @IDINITDIALOG
      DEF lastTitle:string
      CENTERWINDOW titleadd
      SETCONTROLTEXT titleadd,19,"1002"
      hSql=dbExecSql(pDB,"SELECT * FROM Info ORDER BY titles")
      dbBindVariable(hSql,1,id)
      dbBindVariable(hSql,2,infoID)
      dbBindVariable(hSql,3,titles)
      dbBindVariable(hSql,4,isbn)
      'Process the first record in the dataset
      dbGetfirst(hSql)
      lastTitle=titles
      ADDSTRING titleadd,2,titles
      'Do the rest of the recordset
      WHILE dbGet(hSql)
         if titles<>lastTitle
            ADDSTRING titleadd,2,titles
            lastTitle=titles
         endif
      ENDWHILE
      dbFreeSQL(hSql)
      SETSELECTED titleadd,2,0

I also tried using DISTINCT in the SELECT statement but this didn't work for some reason..
Peter

Brian

Peterpuk,

Many thanks for your reply - that cleared up the sorting, no problem

What I would like to do is sort the CallDate column (the date column), but I don't see
a way to do it, because the hidden id column is the first to get sorted in a listview

It would be better to have the rows in date order, I think

Thanks for your help so far,

Brian

LarryMc

Quote from: Brian Pugh on April 05, 2007, 04:36:53 AM
...., because the hidden id column is the first to get sorted in a listview
If I'm loading a listview from a database I never enable the sort feature of the listview.  It seems I always run into problems when I do.

I use the "sorting" features of the sql statements to taake care of all of that.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

peterpuk

Brian,
As Larry has stated, if you want your dataset to be in a sorted order, use the ORDER BY clause in the SQL query.

I just about use ORDER BY in every query because I usually want the records to be returned in some sorted order, and by date is one of them.

Just change the query to  "SELECT * FROM BookShop WHERE id="+getid+" ORDER BY CallDate"
but don't forget to turn off the listview sort.
Peter

Rock Ridge Farm (Larry)

I just tried to compile this and it is missing a file "ctl.inc".

billhsln

To: Peterpuk

A better query would be:

hSql=dbExecSql(pDB,"SELECT DISTINCT titles FROM Info ORDER BY titles")

This would only pull the titles and not all the other discarded info, should also be a quicker query (depending on the size of the file).

Bill
When all else fails, get a bigger hammer.

peterpuk

April 17, 2007, 07:23:02 PM #7 Last Edit: April 17, 2007, 07:28:40 PM by peterpuk
Bill,

You're right that using DISTINCT is better (or should I say the CORRECT way to do it), but I couldn't get it to work for some reason. That's why I mentioned it in my post above. When I changed Brian's original code to include DISTINCT, I got no records, so there must be something else I'm overlooking.

Brian should update his code to use the DISTINCT clause if it works, instead of the old ISAM hack that I posted. :)

I haven't written any real database applications in EBasic yet, just examples that I am learning from that I share on the forum if useful (I'm a VB veteran).
Peter

Rock Ridge Farm (Larry)

How did you get it to compile - I can not find the include file.
Can you tell me where it is on your system?

Brian

Larry,

Sorry, didn't see your post. Here's a zip with the ctl files with the correct paths

Brian

Brian

All,

Here's an update to the BookShop.zip featured in the first post here

Brian

maurice1

Excellent example, thanks for sharing!
Maurice

exjoburger

Thanks for this example - it really helps to see a complete program while trying to "learn the ropes"

Brian

You're all welcome. I reckon there's some stuff that could be done better, and some
stuff that would make Paul (Turley) shudder! But it works well enough for what I need

I may be posting an update shortly (help file, updating the deleting of records, etc, cosmetic
changes)

Brian

Techno

Quote from: Brian Pugh on April 18, 2007, 01:47:46 PM
All,

Here's an update to the BookShop.zip featured in the first post here

Brian


I try to compiled the project in my IWBasic 3.0 Professional but it fails. What happens. What do I wrong here?



Compiling Resources...

Error!
No resources found in RC file
RES file not made
Error compiling resources

Compiling...
BookShop.eba
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (77) Warning: Argument 9 (main) does not match the declaration of IWBDLGPROC
Different return type: none, should be int
File: C:\IWBDev3\bin\iwbstd.incc (9) Warning: See previous declaration of IWBDLGPROC
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (142) Warning: See previous declaration of main
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (176) Warning: Argument 9 (AddTitle) does not match the declaration of IWBDLGPROC
Different return type: none, should be int
File: C:\IWBDev3\bin\iwbstd.incc (9) Warning: See previous declaration of IWBDLGPROC
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (689) Warning: See previous declaration of AddTitle
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (188) Warning: Argument 9 (EditTitle) does not match the declaration of IWBDLGPROC
Different return type: none, should be int
File: C:\IWBDev3\bin\iwbstd.incc (9) Warning: See previous declaration of IWBDLGPROC
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (759) Warning: See previous declaration of EditTitle
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (198) Warning: Argument 9 (NewBookShop) does not match the declaration of IWBDLGPROC
Different return type: none, should be int
File: C:\IWBDev3\bin\iwbstd.incc (9) Warning: See previous declaration of IWBDLGPROC
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (867) Warning: See previous declaration of NewBookShop
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (221) Warning: Argument 9 (EditBookShop) does not match the declaration of IWBDLGPROC
Different return type: none, should be int
File: C:\IWBDev3\bin\iwbstd.incc (9) Warning: See previous declaration of IWBDLGPROC
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (802) Warning: See previous declaration of EditBookShop
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (244) Warning: Argument 9 (DoFind) does not match the declaration of IWBDLGPROC
Different return type: none, should be int
File: C:\IWBDev3\bin\iwbstd.incc (9) Warning: See previous declaration of IWBDLGPROC
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (944) Warning: See previous declaration of DoFind
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (255) Warning: Argument 9 (DoAbout) does not match the declaration of IWBDLGPROC
Different return type: none, should be int
File: C:\IWBDev3\bin\iwbstd.incc (9) Warning: See previous declaration of IWBDLGPROC
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (1026) Warning: See previous declaration of DoAbout
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (266) Warning: Argument 9 (prefssub) does not match the declaration of IWBDLGPROC
Different return type: none, should be int
File: C:\IWBDev3\bin\iwbstd.incc (9) Warning: See previous declaration of IWBDLGPROC
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (1042) Warning: See previous declaration of prefssub
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (1159) Warning: Argument 9 (Browse) does not match the declaration of IWBWNDPROC
Different return type: none, should be int
File: C:\IWBDev3\bin\iwbstd.incc (10) Warning: See previous declaration of IWBWNDPROC
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (1201) Warning: See previous declaration of Browse
File: f:\ionicwind\forum\iwbasic\database\examples\db program\bookshop\v1.1\src\BookShop.eba (65) Warning: Unreferenced variable 'hIcon'
Build Failed


Brian

I'll have a look tomorrow night. You appear to have the files in different paths to the original. Not knowing
what your setup is, it's hard to tell

I haven't done anything with the program for quite a number of years now, so I am a bit rusty with it

Tell me, are you determined to go through EVERY program and example that's ever been posted,
whether you need it or not? Personally, I find your requests quite tiresome. You don't seem to have
learned anything at all, even with the large amount of code you must have already downloaded



Brian

Egil

June 07, 2015, 01:40:41 PM #16 Last Edit: June 07, 2015, 01:54:53 PM by Egil
Techno:
I do not know what you are trying to do, but most of the code you report problems with, compile just fine here with me.
Below is a screendump of this particular program, which is an excellent piece of work (Thanks for sharing Brian!).

When you first load a converted EB project  into IWB 3.0, you get a warning saying that the paths have changed. Then you are asked by IWB if the paths should be corrected. If you answer YES to that question, I am quite convinced that all your problems will vanish.

And if you forget to change the extension of the source files from eba to iwb, like I see you always do, this should not be a problem if the eba-file still exists in the same folder. Otherwise you have to correct the file extensions from whithin the open project. (But at present IWB 3.0 also happily compiles eba source files)

I do not want to be rude, but it is about time you start reading the User Guide, and try to understand what the error codes mean. And then strick to the same project until you get it to work. It is not difficult, but you have to put some effort into the learning process.
By jumping into a new project as soon as you run into problems, you will never learn to use this wonderful programming tool.


Good luck!

Egil


Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

Techno
The whole purpose of the build window is to tell you what is going on during the  building of an application; in this case a project.

Warnings and errors are displayed.
Warnings are displayed for informational purposes and can be ignored.
Errors are just that and will keep and exe file from being created.

You posted the contents of the of the build window above. The only error I see is:
QuoteCompiling Resources...

Error!
No resources found in RC file
RES file not made
Error compiling resources

What caused that is that is that you unzipped the project to a different path than it was originally created in which made the paths to the images in the rc files invalid and that caused the error.

I suggest to you and other members that you figure out how to fix the rc file yourself. It will probably require that you unzip the rc file again(it may be blank now).
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Techno

Quote from: LarryMc on June 07, 2015, 01:58:51 PM
Techno
The whole purpose of the build window is to tell you what is going on during the  building of an application; in this case a project.

Warnings and errors are displayed.
Warnings are displayed for informational purposes and can be ignored.
Errors are just that and will keep and exe file from being created.

You posted the contents of the of the build window above. The only error I see is:
QuoteCompiling Resources...

Error!
No resources found in RC file
RES file not made
Error compiling resources

What caused that is that is that you unzipped the project to a different path than it was originally created in which made the paths to the images in the rc files invalid and that caused the error.

I suggest to you and other members that you figure out how to fix the rc file yourself. It will probably require that you unzip the rc file again(it may be blank now).

Ok

I try this and created a new project and add the source files. I hope that it works.

Kind regards
Stephane