How to edit records in a table?

systems1

Member
Licensed User
Longtime User
Hi everyone,

Iam new to android so please help me to do this.

my problem is,

I have a student table . and i have a button to edit and delete . when i try to delete selected record the table selected row return -1 .

i attached my sample code herewith.

How can i fix it ?

Please help me?

Regards,
 

Attachments

  • test.zip
    8.5 KB · Views: 199

klaus

Expert
Licensed User
Longtime User
First you should change line 101 in the display routine from
edit_delete_id = rc.Row -1
to
edit_delete_id = GetCell(rc.Row, 0)

Second, it's normal that SelectedRow = -1 after deleting. It's set to this value in ClearAll which is called in Loaddatas and it's logical too because after deleting the selected row there is no selected row anymore.
What SelectedRow value did you expect ?

Best regards.
 
Upvote 0

systems1

Member
Licensed User
Longtime User
What SelectedRow value did you expect ?

Actually i expect id of the record which is displayed in the table as ID.
This code is working fine.

But i have a doubt. If i don't want to display ID in table How can i get record id?

eg:table structure

NAME | ADDRESS | PLACE
test | somaddres | some place

in this case i thing it is not a good idea to select Selectedrow of table id.

How can we do that?

Please Help me
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Confirmed , for some reason the zip is corrupt ?
Cheers mj
 
Upvote 0

wheretheidivides

Active Member
Licensed User
Longtime User
you use marget's DB class, it's a breeze. You put the variable (expyear) into the filed (var1), then update record. It's so easy compared to that other db nonsense.

db.PutField("var1", ExpYear)
db.UpdateRecord
 
Upvote 0
Top