[Gambas-user] Stumped by .99
Craig Packard
cpackard at ...626...
Mon Sep 20 13:42:42 CEST 2004
On Sun, 19 Sep 2004 07:19:07 +0200, ron <ronstk at ...239...> wrote:
>
> Do you have?
>
> DIM $hConn As NEW Connection
>
> WITH $hConn
> .Type = "postgresql"
> .Host = "localhost"
> .Login = "username"
> .Password = "passwd"
> .Name = "testdb"
> END WITH
>
> TRY $hConn.Open
> IF Error THEN PRINT "Cannot Open Database. Error = "; Error.Text
>
Yes I have that stuff. Except of course mysql instead of postgresql.
> See Connection.Open again in help
> Pay attention to the TRY and IF Error line!
>
> ---------------------------
>
> Conn.Edit("customers") requires Primary key in table for this.
> See Changelog
> Did you declare rData ?
>
> ----------------------
>
Yes I declared rData, I'll have to look and see if my table has a
primary key. I'd would think it does, but I didn't actually check!
> change
> i = rData.MoveTo[CInt(txtRecNumber.Text)]
> to
> i = rData.MoveTo(VAL(txtRecNumber.Text))
> For rData.MoveTo see help for syntax. Not [] but ()
>
> Note: Cint should be right but its argument must be real number
> as numeric or "123". A pure ASCII string as 3 bytes.
> A textbox.text is for some reason not qualified as argument for CInt().
> Can be different character set and is not always pure ASCII.
> In a logic view you are right to use it, but practice is different.
>
Actually I put the CInt() in just to try and get it to work! But
thanks for the tip. I didn't know that!
> ---------------
>
> > And it constantly throws an error: "Not an object"
> Where is it thrown. The line?
>
It throws it when it gets to Textbox5.Text. If I replace that with 1
then it works. So it is something about the way it is trying to read
the textbox?
> If the Conn.Open not works then Conn.Edit() does not work
> and then there is no rData.
>
There is rData, I can hard code the 1 into the moveto and it works.
Thanks for your tips and suggestions. I'll try the other things you suggested.
More information about the User
mailing list