[Gambas-user] Stumped by .99

ron ronstk at ...239...
Tue Sep 21 07:07:03 CEST 2004


On Tuesday 21 September 2004 02:25, Craig Packard wrote:

> Bingo, moveto is working thanks to ( ).  
I told you :)

change 
   i = rData.MoveTo[CInt(txtRecNumber.Text)]
to
   i = rData.MoveTo(VAL(txtRecNumber.Text))  
For rData.MoveTo see help for syntax.  Not [] but () <-------------


> 
> <CODESNIP>
>   WITH Conn
>     .Type = frmMain.strType
>     .Host = frmMain.strHost
>     .Login = frmMain.strLogin
>     .Password = frmMain.strPassword
>     .Name = frmMain.strDataBase
>   END WITH
>   Conn.Open
>   Conn.Begin 'Is this and commit needed with MySQL?
>   IF txtRecNumber.Text = "*" THEN
>     rData = Conn.Create("customers")
>   ELSE
>     rData = Conn.Edit("customers")
>   END IF
>   rData.MoveTo(Val(txtRecNumber.Text))
>   rData["name"] = textbox1.Text
>   rData["contact"] = textbox2.Text 
>   rData["address1"] = textbox3.Text
>   rData["address2"] = textbox4.Text
>   rData["city"] = textbox5.Text
>   rData["state"] = textbox6.Text
>   rData["zip"] = textbox7.Text                   
>   rData["terms"] = textbox8.Text 
>   rData.Update()
>   Conn.Commit
>   rData.Connection.Close
>   Conn.Close
> </CODESNIP>
> 
> Also note in my screen shot that my Watch window is 'docked' or stuck
> to the project window.  That wasn't like that before. I must admit I
> hate it being docked.  It makes me stretch my project window real wide
> so I can read the watch messages.
> 
> Thanks again for any help.
> 
> 
>            - Craig
> 
Try rData.Update instead rData.Update()

See the source for the database manager. 
There are really good examples how to use the gb.db component.
Not a easy one, because the many separate class files.
But using the 'Find' tool searching for the methos you can use it.

For the screenshot, it does not tell me anything, sorry.
The blue marked line, if that is the error line, wants
on the form two objects, textbox1 and textlabel1.
Are the objects there and have the correct name (in property sheet)?
 
I never used the watch, It's me unclear how it works anyway.
I had the same error as you, now I know about the uppercase problem.
I learned without it. :)




More information about the User mailing list