I need Help for MySQL
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Manolo.
Hi,
I am e new register user (only 1 month ago)
In the last time I work with UX-Basic, Theos-Basic an C.
In this moment I work in a new proyect. Is one commercial aplicatión and need a power database. I like MySQL (Is free and very very nice), but PB have only via ODBC functions. The sample program in, the manual, call to standard M$(microsoft)for the selection of DSN.
Dont have another functions for CREATE, DROP, ETC and special GRID`s for work in windows???.
Fred, you can build a special sample program for mi??
I sorry for my bad english. I read perfectly and write bad... hehe and speek a little so...
For All: send your surces to [url]mailto:vpardo@infonegocio.com[/url]
My afirmation... PureBasic the special basic for commercial aplications... hehe.
Thanks and Regards.
Manolo
[url]mailto:vpardo@infonegocio.com[/url]
Hi,
I am e new register user (only 1 month ago)
In the last time I work with UX-Basic, Theos-Basic an C.
In this moment I work in a new proyect. Is one commercial aplicatión and need a power database. I like MySQL (Is free and very very nice), but PB have only via ODBC functions. The sample program in, the manual, call to standard M$(microsoft)for the selection of DSN.
Dont have another functions for CREATE, DROP, ETC and special GRID`s for work in windows???.
Fred, you can build a special sample program for mi??
I sorry for my bad english. I read perfectly and write bad... hehe and speek a little so...
For All: send your surces to [url]mailto:vpardo@infonegocio.com[/url]
My afirmation... PureBasic the special basic for commercial aplications... hehe.
Thanks and Regards.
Manolo
[url]mailto:vpardo@infonegocio.com[/url]
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fred.
In fact, I've fixed a bug yesterday which prevented to connect an ODBC Database with the DatabaseREquester() command. Catch the new lib at: http://www.purebasic.com/update/Database. About ODBC, you need to catch the ODBC driver for MySQL and install it (easy). I've done it and it worked perfectly
.
Fred - AlphaSND
Edited by - fred on 10 January 2002 18:21:39
In fact, I've fixed a bug yesterday which prevented to connect an ODBC Database with the DatabaseREquester() command. Catch the new lib at: http://www.purebasic.com/update/Database. About ODBC, you need to catch the ODBC driver for MySQL and install it (easy). I've done it and it worked perfectly

Fred - AlphaSND
Edited by - fred on 10 January 2002 18:21:39
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Manolo.
-University
-Estudents
-Works
-etc, etc
and work fine with SQL.
From update/database I received 1 file database.txt only with non readable characters.
I wait yours sugestions, and if possible send one sample program of this two
manners: source.pb and *.exe.
Thansk.
Manolo
[url]mailto:vpardo@infonegocio.com[/url]
I have ready MySQL and the ODBC. From MySQL Query I make the next database:
In fact, I've fixed a bug yesterday which prevented to connect an ODBC Database with the DatabaseREquester() command. Catch the new lib at: http://www.purebasic.com/update/Database. About ODBC, you need to catch the ODBC driver for MySQL and install it (easy). I've done it and it worked perfectly.
Fred - AlphaSND
-University
-Estudents
-Works
-etc, etc
and work fine with SQL.
From update/database I received 1 file database.txt only with non readable characters.
I wait yours sugestions, and if possible send one sample program of this two
manners: source.pb and *.exe.
Thansk.
Manolo
[url]mailto:vpardo@infonegocio.com[/url]
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Manolo.
Hi Fred,
Ok in this momento I have working all, but with a minors problems....
I thing that OpenDatabase(#Database, ODBCDatabaseName$, User$, Password$)don't work correctly and call to Data Origin Selection because need andothers ADO parameters.
The correct syntas for open directly from programs is:
OpenDatabase(#Database, Server$, ODBCDatabaseName$, Driver$, User$, Password$)
#Database=Constant number
Server$=localhost or IP direction i.e. 192.168.0.2
ODBCDataBase$="Clients"
Driver$=the ODBC name driver i.e. "MySQL"
User$=""
Password$=""
Is possible the ADO implementation with news commands similar to VBScript or Perl or PHP???
Thanks. I wait you reply.
Manolo
[url]mailto:vpardo@infonegocio.com[/url]
Hi Fred,
Ok in this momento I have working all, but with a minors problems....
I thing that OpenDatabase(#Database, ODBCDatabaseName$, User$, Password$)don't work correctly and call to Data Origin Selection because need andothers ADO parameters.
The correct syntas for open directly from programs is:
OpenDatabase(#Database, Server$, ODBCDatabaseName$, Driver$, User$, Password$)
#Database=Constant number
Server$=localhost or IP direction i.e. 192.168.0.2
ODBCDataBase$="Clients"
Driver$=the ODBC name driver i.e. "MySQL"
User$=""
Password$=""
Is possible the ADO implementation with news commands similar to VBScript or Perl or PHP???
Thanks. I wait you reply.
Manolo
[url]mailto:vpardo@infonegocio.com[/url]
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Paul.
The database functions of PB work great. I have written a large number of apps now using the database functions. The Forum at the "PB Resources Site" uses database functions (SQL) heavily and is completely written in PB.
You easiest way is to set up your database in the Windows Control Panel - ODBC Data Sources (I set mine up under System DSN). You can use any database drivers that are listed there (Access,FoxPro, Oracle,Excel,Paradox, etc.)and give your database an alias name. This is the name you call (ODBCDatabaseName$) to open the database. The SQL language provides all the commands you need to manipulate and work with your database.
Hello Manolo,I thing that OpenDatabase(#Database, ODBCDatabaseName$, User$, Password$)don't work correctly and call to Data Origin Selection because need andothers ADO parameters.
The database functions of PB work great. I have written a large number of apps now using the database functions. The Forum at the "PB Resources Site" uses database functions (SQL) heavily and is completely written in PB.
You easiest way is to set up your database in the Windows Control Panel - ODBC Data Sources (I set mine up under System DSN). You can use any database drivers that are listed there (Access,FoxPro, Oracle,Excel,Paradox, etc.)and give your database an alias name. This is the name you call (ODBCDatabaseName$) to open the database. The SQL language provides all the commands you need to manipulate and work with your database.
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Manolo.
Tks Paul... but... the problemn is other.
You are working with
OpenDatabase(#Database, ODBCDatabaseName$, User$, Password$) ????
For mi and others PureBasic users, needs that the OpenDatabaseName make solutions without PDX and ODBC Console calls, with the implementations into the function requested. This is the OLD style???.. yes. I am old... hehehe.
Is possible???... I wait for de FRED REPLY....
Regards
Manolo
[url]mailto:vpardo@infonegocio.com[/url]
Tks Paul... but... the problemn is other.
You are working with
OpenDatabase(#Database, ODBCDatabaseName$, User$, Password$) ????
Yes, really is correct. But the end user of the my aplications need other way more easy. And I... hehehe (Have 45 years 'very' old) and I've missing the programation from 7 years ago.You easiest way is to set up your database in the Windows Control Panel - ODBC Data Sources (I set mine up under System DSN). You can use any database drivers that are listed there (Access,FoxPro, Oracle,Excel,Paradox, etc.)and give your database an alias name. This is the name you call (ODBCDatabaseName$) to open the database. The SQL language provides all the commands you need to manipulate and work with your database.
For mi and others PureBasic users, needs that the OpenDatabaseName make solutions without PDX and ODBC Console calls, with the implementations into the function requested. This is the OLD style???.. yes. I am old... hehehe.
Is possible???... I wait for de FRED REPLY....
Regards
Manolo
[url]mailto:vpardo@infonegocio.com[/url]
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fred.
OpenDatabaseRequester() works the same, except you have to choose manually the ODBC file and specify again the user/password, even if it was specified in the ODBC file. A fixed version of the Database lib can be found at http://www.purebasic.com/update/Database
Fred - AlphaSND
Edited by - fred on 10 January 2002 21:49:33
OpenDatabaseRequester() works the same, except you have to choose manually the ODBC file and specify again the user/password, even if it was specified in the ODBC file. A fixed version of the Database lib can be found at http://www.purebasic.com/update/Database
Fred - AlphaSND
Edited by - fred on 10 January 2002 21:49:33
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Manolo.
#Database=0
If InitDatabase() =0
MessageRequester("Error", "Can't initialize Database (ODBC v3 or better) environment", 0)
End
EndIf
OpenDefaultConsole()
Dim DatabaseType.s(4)
DatabaseType(0) = "Unknown"
DatabaseType(1) = "Numeric"
DatabaseType(2) = "String"
DatabaseType(3) = "Float"
; First, let's see which drivers are attached to the system..
;
If ExamineDatabaseDrivers()
While NextDatabaseDriver()
; PrintN(DatabaseDriverName()+" - "+DatabaseDriverDescription())
If UCase(DatabaseDriverName())="UNIVERSITY" ; only for directly selection
Goto out:
EndIf
Wend
EndIf
out:
PrintN(DatabaseDriverName()+" Ok selection")
ODBCDatabaseName$=DatabaseDriverName()
User$=""
Password$=""
If OpenDatabase(#Database, ODBCDatabaseName$, User$, Password$);---> don't work... need others parameters
;If OpenDatabaseRequester(#Database)=0 ; --------------------------> uncomented work with mannual selection of the ODBC
MessageRequester("Error", "Can't OPEN the database "+DatabaseDriverName(), 0)
End
EndIf
PrintN("The database # is: ")
PrintN(Str(#Database))
Delay (1000)
End
Manolo
[url]mailto:vpardo@infonegocio.com[/url]
Fred, sorry but the next code don't work:OpenDatabaseRequester() works the same, except you have to choose manually the ODBC file and specify again the user/password, even if it was specified in the ODBC file. A fixed version of the Database lib can be found at http://www.purebasic.com/update/Database
#Database=0
If InitDatabase() =0
MessageRequester("Error", "Can't initialize Database (ODBC v3 or better) environment", 0)
End
EndIf
OpenDefaultConsole()
Dim DatabaseType.s(4)
DatabaseType(0) = "Unknown"
DatabaseType(1) = "Numeric"
DatabaseType(2) = "String"
DatabaseType(3) = "Float"
; First, let's see which drivers are attached to the system..
;
If ExamineDatabaseDrivers()
While NextDatabaseDriver()
; PrintN(DatabaseDriverName()+" - "+DatabaseDriverDescription())
If UCase(DatabaseDriverName())="UNIVERSITY" ; only for directly selection
Goto out:
EndIf
Wend
EndIf
out:
PrintN(DatabaseDriverName()+" Ok selection")
ODBCDatabaseName$=DatabaseDriverName()
User$=""
Password$=""
If OpenDatabase(#Database, ODBCDatabaseName$, User$, Password$);---> don't work... need others parameters
;If OpenDatabaseRequester(#Database)=0 ; --------------------------> uncomented work with mannual selection of the ODBC
MessageRequester("Error", "Can't OPEN the database "+DatabaseDriverName(), 0)
End
EndIf
PrintN("The database # is: ")
PrintN(Str(#Database))
Delay (1000)
End
Manolo
[url]mailto:vpardo@infonegocio.com[/url]
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Paul.
Manolo, if you turn your debugger on it will tell you what lines are causing the problem further on in your program. These changes will make it work:
I can tell you right now you will have problems down the road because your code is somewhat sloppy and does not tie up loose ends
For example... You jump out of your loop (goto) when you find "University" but if not found, you will still leave the loop with the last database found and end up opening that by default.
Manolo, if you turn your debugger on it will tell you what lines are causing the problem further on in your program. These changes will make it work:
Code: Select all
#Database=0
If InitDatabase() =0
MessageRequester("Error", "Can't initialize Database (ODBC v3 or better) environment", 0)
End
EndIf
OpenConsole()
Dim DatabaseType.s(4)
DatabaseType(0) = "Unknown"
DatabaseType(1) = "Numeric"
DatabaseType(2) = "String"
DatabaseType(3) = "Float"
; First, let's see which drivers are attached to the system..
;
If ExamineDatabaseDrivers()
While NextDatabaseDriver()
ddn$=DatabaseDriverName()
ddd$=DatabaseDriverDescription()
PrintN(ddn$+" - "+ddd$)
If UCase(ddn$)="UNIVERSITY" ; only for directly selection
Goto out
EndIf
Wend
EndIf
out:
PrintN(ddn$+" Ok selection")
ODBCDatabaseName$=ddn$
User$=""
Password$=""
If OpenDatabase(#Database, ODBCDatabaseName$, User$, Password$)
;open
else
MessageRequester("Error", "Can't OPEN the database", 0)
End
EndIf
PrintN("The database # is: ")
PrintN(Str(#Database))
Delay (1000)
End
I can tell you right now you will have problems down the road because your code is somewhat sloppy and does not tie up loose ends

For example... You jump out of your loop (goto) when you find "University" but if not found, you will still leave the loop with the last database found and end up opening that by default.
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Paul.
Personally I would do it something like this...
Edited by - paul on 11 January 2002 16:17:49
Personally I would do it something like this...
Code: Select all
If InitDatabase() =0
MessageRequester("Error", "Can't initialize Database (ODBC v3 or better)environment", 0)
End
EndIf
User$=""
Password$=""
ODBCDatabaseName$=""
#Database=0
If ExamineDatabaseDrivers()
While NextDatabaseDriver()
ddn$=DatabaseDriverName()
ddd$=DatabaseDriverDescription()
If UCase(ddn$)="UNIVERSITY"
ODBCDatabaseName$=ddn$
EndIf
Wend
Else
MessageRequester("Error", "No Database Drivers Found", 0)
EndIf
If ODBCDatabaseName$=""
If OpenDatabaseRequester(#Database)=0
MessageRequester("Error", "Can't OPEN the database", 0)
End
EndIf
Else
If OpenDatabase(#Database, ODBCDatabaseName$, User$, Password$)
;ok
Else
MessageRequester("Error", "Can't OPEN the database", 0)
End
EndIf
EndIf
MessageRequester("Success", "Database has been Opened!", 0)
CloseDatabase(#Database)
End
Edited by - paul on 11 January 2002 16:17:49
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Manolo.
Yes, I like more this second example. Tomorrow I work all day in this second.
I sorry very much for my bad english writed. And you say "You welcome" hehe.
In the last century I has trip several times to Canada. Toronto and Waterloo Kitchener included. I has the distribution for Spain and Portugal of the "PRO-C" and Watcom products.
Bad economics years for me... I don't want remember...
Ok. See you tomorrow.
Manolo
[url]mailto:vpardo@infonegocio.com[/url]
Hi Paul. Very very thanks. I only see the first example and woooooork correctly with others implementations on myself.Personally I would do it something like this...
Edited by - paul on 11 January 2002 16:17:49
Yes, I like more this second example. Tomorrow I work all day in this second.
I sorry very much for my bad english writed. And you say "You welcome" hehe.
In the last century I has trip several times to Canada. Toronto and Waterloo Kitchener included. I has the distribution for Spain and Portugal of the "PRO-C" and Watcom products.
Bad economics years for me... I don't want remember...
Ok. See you tomorrow.
Manolo
[url]mailto:vpardo@infonegocio.com[/url]