1. Gaurav Joshi
  2. Valentina Database ADK
  3. 土, 12月 31 2022, 01:27 PM
  4.  メールで購読
Hello Everyone,

I am trying to update a record in Valentina DB using the below.

Tbl = mDatabase.Table( "UserList" )
Tbl.RecID = ULSelectedID.ToInteger
Tbl.StringField(1).Value = ULSelectedID
Tbl.StringField(2).Value = UserListContainer1.ULUserNameTextField.Text
Tbl.StringField(3).Value = UserListContainer1.ULLastNameTextField.Text
Tbl.StringField(4).Value = UserListContainer1.ULLoginNameTextField.Text
Tbl.StringField(5).Value = UserListContainer1.ULPasswordTextField.Text
Tbl.StringField(6).Value = UserListContainer1.ULUserRolePopup.SelectedRowValue
Tbl.StringField(7).Value = ULStatus
Tbl.UpdateAllRecords

I wish to make use of the above for the below SQL equivalent statement

"UPDATE USERLIST SET USERNAME = :2, USERLASTNAME = :3, LOGINNAME = :4, PASSWORD = :5, USERROLE = :6, USERSTATUS = :7 WHERE ID = :1"

However, I am confused with how to use UpdateAllRecords statement to do the function as the UPDATE statement of SQL using Where.

In the above example, I want to update the Username, UserLastname, LoginName, Password, Userrole, UserStatus where ID is a specific selected ID stored in a variable ULSelected ID.

The database is having a table UserList with 7 columns, where first column is the USERID followed by Username, UserLastname, LoginName, Password, Userrole, UserStatus.

Please support. In the event, UpdateAllRecords API is unsuitable to do the above, please suggest some alternate method. I am programming in Xojo.
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
コメント
There are no comments made yet.
Ruslan Zasukhin 承諾済みの回答
Hi Gaurav,

can I point out that probably better to use SQL?
then more that you are going to work with a client-server model.

API way can be more attractive for local-only apps.
コメント
There are no comments made yet.
Ruslan Zasukhin 承諾済みの回答
Another tip:

exists yet VCursor class.

Working with it is similar to MySQL and recordSet I think.
VCursor adds record locks to managed records, it has similar to VTable record methods: AddRecord(), UpdateRecord()

And the most modern and fastest for the client-server model is work via VSqlStatement, which can do also binding, etc.
参照
  1. http://valentina-db.com/docs/dokuwiki/v12/doku.php?id=valentina:products:adk:api:vdatabase_class:sql_methods#vdatabasecreatesqlstatement
コメント
There are no comments made yet.
  • ページ :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories