[Gambas-user] Adding values to fields in SQLite table??
rocko
sunblaster5 at ...626...
Wed Aug 8 20:31:10 CEST 2012
If I do that I get an error:"$hConn already declared in FMain Class"
I already have a "Private $hConn As Connection" in the class Form.
If I put in the btnAdd sub I get:"Unexpected Private in Fmain Class"
On Wed, 2012-08-08 at 20:18 +0200, Fabien Bodard wrote:
> Do not do dim hconn...
>
> Just say
> Private $hconn as new connection
> Le 8 août 2012 20:14, "rocko" <sunblaster5 at ...626...> a écrit :
>
> > Is it DB.Create/DB.Commit?? I was using $hConn.Create and so on.
> >
> > I'm getting 'Connection Not Opened" error when click the Add_new btn.
> >
> >
> > btnConnect CODE:
> > PRIVATE $hConn AS Connection
> > PUBLIC SUB btnConnect_Click()
> >
> > DIM $hConn AS NEW Connection
> >
> > $hConn.Host = "/home/rocko/DataBases"
> > $hConn.Name = "my_test.sqlite"
> > $hConn.Type = "sqlite"
> > $hConn.Open
> >
> > btnAdd CODE:
> >
> > PUBLIC SUB btnAdd_Click()
> >
> > DIM $hConn AS NEW Connection
> > DIM rTable AS Result
> >
> > rTable = DB.Create("inventory")
> >
> > IF rTable.Available THEN
> > rTable!name = txtName.Text
> > rTable.Update
> > TRY rTable.Update
> > IF ERROR THEN
> > PRINT "Update failed"
> > Message.Error(ERROR.Text)
> >
> > ENDIF
> > ENDIF
> >
> > DB.Commit
> >
> > btnClose CODE:
> > PUBLIC SUB btnClose_Click()
> >
> > $hConn.Close
> > FMain.Close
> >
> > On Wed, 2012-08-08 at 19:48 +0200, Fabien Bodard wrote:
> > > Private $hConn as New Connection
> > > Public sub _New()
> > > $hConn .Host = "dir of bdd"
> > > $hConn.Name = "MyBdd"
> > > $hConn.Type = "sqlite"
> > > $hConn.Open
> > >
> > > End
> > >
> > >
> > > PUBLIC SUB btnAdd_Click()
> > >
> > > DIM rTable AS Result
> > >
> > > rTable = DB.Create("inventory")
> > >
> > > rTable!name = txtName.Text
> > >
> > > TRY rTable.Update
> > > IF ERROR THEN
> > > PRINT "Update failed"
> > > Message.Error(ERROR.Text)
> > > return
> > > ENDIF
> > >
> > >
> > > DB.Commit
> > >
> > > end
> > >
> > > Public SUb Form_Close
> > > $hConn.CLose
> > > end
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > 2012/8/8 rocko <sunblaster5 at ...626...>
> > >
> > > > Im now getting error's.
> > > > I was getting a "connection not opened" error message, so I add
> > > > a $hConn.Open before the $hConn.Begin.
> > > > I'm now getting a "Driver name missing" error.
> > > >
> > > > CODE:
> > > > PUBLIC SUB btnAdd_Click()
> > > >
> > > > DIM $hConn AS NEW Connection
> > > > DIM rTable AS Result
> > > > $hConn.Open
> > > > $hConn.Begin
> > > > '$hConn.Exec("INSERT INTO inventory VALUES(name), txt.Name")
> > > > '$hConn.Commit
> > > > rTable = $hConn.Create("inventory")
> > > >
> > > > IF rTable.Available THEN
> > > > rTable!name = txtName.Text
> > > > rTable.Update
> > > > TRY rTable.Update
> > > > IF ERROR THEN
> > > > PRINT "Update failed"
> > > > Message.Error(ERROR.Text)
> > > >
> > > > ENDIF
> > > > ENDIF
> > > >
> > > > $hConn.Commit
> > > > $hConn.Close
> > > >
> > > > On Wed, 2012-08-08 at 19:17 +0200, Fabien Bodard wrote:
> > > > > 2012/8/8 rocko <sunblaster5 at ...626...>
> > > > >
> > > > > > Is there anyway to translate that??
> > > > > >
> > > > > google ?
> > > > >
> > > > >
> > > > > >
> > > > > > On Wed, 2012-08-08 at 19:01 +0200, Fabien Bodard wrote:
> > > > > > > it's in french but ...
> > > > > > >
> > > > > > >
> > > > http://www.gambasforge.org/code-56-apprehender-sqlite-avec-gambas.html
> > > > > > >
> > > > > >
> > > >
> > ------------------------------------------------------------------------------
> > > > > > > Live Security Virtual Conference
> > > > > > > Exclusive live event will cover all the ways today's security and
> > > > > > > threat landscape has changed and how IT managers can respond.
> > > > Discussions
> > > > > > > will include endpoint security, mobile security and the latest in
> > > > malware
> > > > > > > threats.
> > http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > > > > > > _______________________________________________
> > > > > > > Gambas-user mailing list
> > > > > > > Gambas-user at lists.sourceforge.net
> > > > > > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > >
> > ------------------------------------------------------------------------------
> > > > > > Live Security Virtual Conference
> > > > > > Exclusive live event will cover all the ways today's security and
> > > > > > threat landscape has changed and how IT managers can respond.
> > > > Discussions
> > > > > > will include endpoint security, mobile security and the latest in
> > > > malware
> > > > > > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > > > > > _______________________________________________
> > > > > > Gambas-user mailing list
> > > > > > Gambas-user at lists.sourceforge.net
> > > > > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > ------------------------------------------------------------------------------
> > > > Live Security Virtual Conference
> > > > Exclusive live event will cover all the ways today's security and
> > > > threat landscape has changed and how IT managers can respond.
> > Discussions
> > > > will include endpoint security, mobile security and the latest in
> > malware
> > > > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > > > _______________________________________________
> > > > Gambas-user mailing list
> > > > Gambas-user at lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > > >
> > >
> > >
> > >
> >
> >
> >
> >
> > ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list