Database's or something easier ?
Database's or something easier ?
I want to make program for a computer store. Basicly, it must have ability to accept input of PC components (monitors, graphic cards, motherboards ... etc), every component must have price. Now, I want something like to choose components from a list and than see sum price and than to print it all.
The problem is: Where do I start ?? I want simpliest possible solution, I've looked some database examples from codearhive but most of them aren't working or they are in German. I would be happiest if I could somehow avoid database learning, if I could store my data in a .txt file or something like that. Any good turtorial for a newbie ?
The problem is: Where do I start ?? I want simpliest possible solution, I've looked some database examples from codearhive but most of them aren't working or they are in German. I would be happiest if I could somehow avoid database learning, if I could store my data in a .txt file or something like that. Any good turtorial for a newbie ?
- the.weavster
- Addict
- Posts: 1577
- Joined: Thu Jul 03, 2003 6:53 pm
- Location: England
I think you'll find working with databases much easier than working with text files.
go to www.purearea.net and check out the English code archive for examples.
go to www.purearea.net and check out the English code archive for examples.
Yes, that's the one I have. It's very confusing for a newbie and lots of code doesn't work with PB 3.94. That codearhive should be updated more oftenthe.weavster wrote:I think you'll find working with databases much easier than working with text files.
go to www.purearea.net and check out the English code archive for examples.
Yes and the MDB_Lib will also work with mySQL databases.
I have used the SQLite3 library from the PureBasic Open Source Library and have found it very easy to use. It is nice for single user databases.
http://pbosl.purearea.net/
I have used the SQLite3 library from the PureBasic Open Source Library and have found it very easy to use. It is nice for single user databases.
http://pbosl.purearea.net/
-jb
I wonder how did you manage to start any examples from "pbosl_examples" ??
When I try to compile "PBOSL_sqlite3_test.pb" this error ocurs:
Line 11:SQLite3_Init() is not a function, an array, or a linked list
Also when I try to start "Get_mdb_data_Tool.pb" error:
Line 177:MakeConnection() is not a function, an array, or a linked list
It's too late now, I'll try Droopy's library tomorrow
When I try to compile "PBOSL_sqlite3_test.pb" this error ocurs:
Line 11:SQLite3_Init() is not a function, an array, or a linked list
Also when I try to start "Get_mdb_data_Tool.pb" error:
Line 177:MakeConnection() is not a function, an array, or a linked list
It's too late now, I'll try Droopy's library tomorrow
when I compile "PBOSL_sqlite3_test.pb"BOOGIEMAN wrote:I wonder how did you manage to start any examples from "pbosl_examples" ??
When I try to compile "PBOSL_sqlite3_test.pb" this error ocurs:
Line 11:SQLite3_Init() is not a function, an array, or a linked list
Also when I try to start "Get_mdb_data_Tool.pb" error:
Line 177:MakeConnection() is not a function, an array, or a linked list
It's too late now, I'll try Droopy's library tomorrow


PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

This is what you get if you try to run the example without installing the library (and, in my case, then removing the "duplicate" references).BOOGIEMAN wrote:I wonder how did you manage to start any examples from "pbosl_examples" ??
When I try to compile "PBOSL_sqlite3_test.pb" this error ocurs:
Line 11:SQLite3_Init() is not a function, an array, or a linked list
Also when I try to start "Get_mdb_data_Tool.pb" error:
Line 177:MakeConnection() is not a function, an array, or a linked list
It's too late now, I'll try Droopy's library tomorrow
cheers
BOOGIEMAN here is a small code sample using the PBOSL SQLite3 library.
I hope this helps.
Code: Select all
;Window Constants
Enumeration
#Window_Main
EndEnumeration
;Gadget Constants
Enumeration
#Text_Name
#Text_City
#String_Name
#String_City
#Button_Save
EndEnumeration
;Recordset structure
Structure RecordSet
BOF.l
EOF.l
Handle.l
Rows.l
Cols.l
CurrentPos.l
Value.s
EndStructure
Procedure Open_Window_Main()
If OpenWindow(#Window_Main, 241, 37, 305, 121, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "Database Sample")
If CreateGadgetList(WindowID())
TextGadget(#Text_Name, 10, 10, 50, 20, "Name:")
TextGadget(#Text_City, 10, 40, 50, 20, "City:")
StringGadget(#String_Name, 60, 10, 210, 20, "")
StringGadget(#String_City, 60, 40, 210, 20, "")
ButtonGadget(#Button_Save, 110, 70, 80, 25, "Save")
EndIf
EndIf
EndProcedure
;main
If SQLite3_Init() = #False
MessageRequester("Data Sample", SQLite3_GetLastMessage())
End
EndIf
dbName$ = "Sample.db"
;open database
dbHandle.l = SQLite3_OpenDatabase(dbName$)
If dbHandle = 0
;create new database
dbHandle = SQLite3_CreateDatabase(dbName$, #True)
If dbHandle = 0
MessageRequester("Data Sample", SQLite3_GetLastMessage())
End
EndIf
EndIf
;create the Client table
SQL$ = "CREATE TABLE Sample (Name, City)"
SQLite3_Execute(SQL$, dbHandle)
Open_Window_Main()
Repeat ; Start of the event loop
Event = WaitWindowEvent()
GadgetID = EventGadgetID()
If Event = #PB_EventGadget
If GadgetID = #Button_Save
;get gadget values
Name$ = Trim(GetGadgetText(#String_Name))
City$ = Trim(GetGadgetText(#String_City))
SQLite3_Execute("BEGIN TRANSACTION", dbHandle)
SQL$ = "INSERT INTO Sample (Name, City) VALUES ('" + Name$ + "', '" + City$ + "')"
SQLite3_Execute(SQL$, dbHandle)
SQLite3_Execute("COMMIT TRANSACTION", dbHandle)
;make sure record was added
If SQLite3_GetLastMessage() = "OK"
MessageRequester("Data Sample", "Record Added")
SetGadgetText(#String_Name,"")
SetGadgetText(#String_City,"")
Else
MessageRequester("Data Sample", SQLite3_GetLastMessage())
EndIf
EndIf
EndIf
Until Event = #PB_Event_CloseWindow ; End of the event loop
;close database
SQLite3_CloseDatabase(dbHandle)
SQLite3_End()
End
;
-jb
Or, you could grab kBilling! 

-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net