[Gambas-user] Extracting fields from a Result
T Lee Davidson
t.lee.davidson at gmail.com
Mon Jan 1 18:34:55 CET 2018
On 01/01/2018 12:17 PM, T Lee Davidson wrote:
> On 01/01/2018 02:47 AM, Doug Hutcheson wrote:
[snip]
>>
>> Why am I seeing these password problems when the Connection objects they are using connect perfectly?
>
> Good question. I am having a similar issue, but all I get is "Cannot open database:" - no reason given. "Common.CheckDB.34" tops
> the Stack backtrace.
>
> I don't know if it's related, but when I set the properties for the Connection, I did not enable "Remember password". Yet, I got
> an error message, "Unable to save password. Cannot store passwords on desktop KDE5: No wallet found". The error is correct;
> there is no wallet. But I shouldn't have gotten any error because I did not elect to save the password.
>
> The Connection can read the database statically through the IDE, but apparently not at runtime.
BTW, Doug, did you try the command line application version I posted? Or, in your graphical application, you could try setting
the database connection programmatically to bypass the IDE's Connection component as that appears it might have issues (or we're
doing something wrong).
[code]
' Gambas module file
Public Sub Main()
Dim hConn As New Connection
Dim rField As ResultField
Dim MyResult As Result
hConn.Type = "postgresql" ' Type of connection
hConn.Host = "localhost" ' Name of the server
hConn.Login = "postgres" ' User's name for the connection
hConn.Port = "5432" ' Port to use in the connection, usually 3306
hConn.Name = "postgres" ' Name of the database we want to use
hConn.Password = "mypgpass" ' User's password
hConn.Open() ' Open the connection
If Error Then
Print "OUCH!!"
Else
Print "Connected."
Endif
MyResult = hConn.Exec("select * from users")
Debug MyResult.Fields.Count
Debug MyResult!id
For Each rField In MyResult.Fields
Print rField.Name
Next
End
[/code]
--
Lee
More information about the User
mailing list