KNOWING ALL THE SIMPLE OR BETTER CODES FOR INSERT DELETE UPDATE

Hi guys i want to know how to INSERT DATA with CONTOLS TEXTFIELD

Typing? Pasting? Cutting? Copying?
TextField and TextArea work just like text controls in any other program?
So I’m not sure exactly what your question here is.

And of course I won’t be so crude as to mention the Xojo User Guides and Language References :slight_smile:

ow sorry for the question here it is … How to INSERT DATA ??

please rephrase your question.
please show what you have attempted to do, why it failed.
please indicate what parts of normal text handling you do not understand?
please indicate you have read the appropriate sections of the users guide and language reference, and ask question related to those sections that you are not clear about.

please do not attempt to carry on this topic both in public and in private… any responses I provide will be public.

did you look at: sqlite ?

Or: docs SQLite 3.14.1 ?

Or, the classic documentation: SQLiteDatabase ?

Emile… might I ask what SQLite has to do with inserting text into a TextField per the OP?

Dave…please…

also have a look at the xojo examples, for instance the “eddie electronic” app example
will show you how to read and insert datas into the sql database from a window with text controls.

The quote SQL COMMAND that’s my problem i can’t insert record from my database … can you guys please give me any solution ??

'//THIS IS FOR MSSQL
'//Dim db As New MySQLCommunityServer
dim db as new MSSQLServerDatabase
'//For WebDialog
dim f as new WebDialog1
f.Show
'//SET NEEDED PARAMETER
db.Host = “(local)”
//db.Port = 1513 not needed if MSSQL
db.DatabaseName = “raf”
db.UserName = “sa”
db.Password = “Pastilan123”
'//FINISHED SETINGS OF PARAMETERS

'//OPENING NOW
if db.connect then

 '//use this to start the update/insert/delete
db.SQLExecute("START TRANSACTION")
'//

'//to inform datbase to save immediately
db.SQLExecute("AUTO COMMIT")



'//THIS IS THE SQL COMMAND


db.SQLExecute ("INSERT INTO Raf (Id, firstname, lastname, age, gender, birthdate) VALUES "_
+"(9, 'ryuji', 'florendo', 24, 'male', 1992/06/13,)")
If db.Error then
  MsgBox("Error: " + db.ErrorMessage)
  db.Rollback
  
Else
  db.Commit
End If

Else
MsgBox("The database couldn’t be opened. Error: " + db.ErrorMessage)

'//finally save the record physically
db.commit


'//CHECK IF ENCOUNTERED ERROR
if not db.Error then
  msgbox("Sucess!")
  
ELSE
  MSGBOX("FAILED")
  
  
end if 

End If
'//done SAVING

The quote SQL COMMAND that’s my problem i can’t insert record from my database … can you guys please give me any solution ??

[quote=284920:@RAF FLORENDO III]

'//THIS IS FOR MSSQL
'//Dim db As New MySQLCommunityServer
dim db as new MSSQLServerDatabase
'//For WebDialog
dim f as new WebDialog1
f.Show
'//SET NEEDED PARAMETER
db.Host = “(local)”
//db.Port = 1513 not needed if MSSQL
db.DatabaseName = “raf”
db.UserName = “sa”
db.Password = “Pastilan123”
'//FINISHED SETINGS OF PARAMETERS

'//OPENING NOW
if db.connect then

 '//use this to start the update/insert/delete
db.SQLExecute("START TRANSACTION")
'//

'//to inform datbase to save immediately
db.SQLExecute("AUTO COMMIT")



'//THIS IS THE SQL COMMAND


db.SQLExecute ("INSERT INTO Raf (Id, firstname, lastname, age, gender, birthdate) VALUES "_
+"(9, 'ryuji', 'florendo', 24, 'male', 1992/06/13,)")
If db.Error then
  MsgBox("Error: " + db.ErrorMessage)
  db.Rollback
  
Else
  db.Commit
End If

Else
MsgBox("The database couldn’t be opened. Error: " + db.ErrorMessage)

'//finally save the record physically
db.commit


'//CHECK IF ENCOUNTERED ERROR
if not db.Error then
  msgbox("Sucess!")
  
ELSE
  MSGBOX("FAILED")
  
  
end if 

End If
'//done SAVING[/quote]

What happens when you try?
By eye the only thing that stands out is this
db.SQLExecute (“INSERT INTO Raf (Id, firstname, lastname, age, gender, birthdate) VALUES “_
+”(9, ‘ryuji’, ‘florendo’, 24, ‘male’, 1992/06/13,)”)

Shouldnt that date be in quotes?

Or if the field is a date field,

STR_TO_DATE(‘1992/06/13’, ‘%Y/%m/%d’)

Yes you can (cft Obama).

I get an eye on the posted channel name because like you I was asking myself what answer the op (RAF) wanted.

Then, I searched some anwsers (but I was in a hurry, thus my concise answer with links)

Well, something goes wrong, and the XOJO debugger will gladly tell you what. Watch this if you haven’t used the debugger before.

Oh, good catch, absolutely. It needs to look like this:

db.SQLExecute (“INSERT INTO Raf (Id, firstname, lastname, age, gender, birthdate) VALUES “_
+”(9, ‘ryuji’, ‘florendo’, 24, ‘male’, ‘1992-06-13’)”)

you need to tell us what’s the db.errormessage gives you in return.

[quote=284923:@Jeff Tullin]What happens when you try?
By eye the only thing that stands out is this
db.SQLExecute (“INSERT INTO Raf (Id, firstname, lastname, age, gender, birthdate) VALUES “_
+”(9, ‘ryuji’, ‘florendo’, 24, ‘male’, 1992/06/13,)”)

Shouldnt that date be in quotes?

Or if the field is a date field,

STR_TO_DATE(‘1992/06/13’, ‘%Y/%m/%d’)[/quote]

i notice an extra comma behind the date string

I am still confused as to the question… since he specifically stated “TEXT CONTROL”

but I will leave this thread to others

Dave: no offense taken. It could be me thinking that.