SQLExample - Edit Data

outlawz

Member
Licensed User
If I remove the single quotes from:

Select 'ubic' From 'inventario' Group By 'ubic' Order By 'ubic' Asc

it works.

Thanks Erel, you´re talking about updating the database, it is my next step. I was talking about populate de combo which it is done.

Thanks
 

outlawz

Member
Licensed User
Hi to you all. Paulo if you read this and have a couple of minutes please tell me how i´m going. It is not completed, i must update database. However i guess it is enough for you to know what i need. I can´t compile, i installed net frameworks but error "can´t find NF files" keeps.

Can you help me please?

Thanks
 

tremara1

Active Member
Licensed User
Longtime User
Example without using a table

This example does not show all the data at once, it shows individual records for a selected option. It does use add, update and delete via sql's. It uses a hidden list to store the data and text boxes to display the data. The textboxes are also used for new entry and update. It is quite comprehensively commented. Have a look it might help.
 

outlawz

Member
Licensed User
Thanks Tremara1, i can´t update record, everytime i close program, at opening all equal. How does it works?

You're example is different than mine, yours is to append records, mine is just to stock control.

Regards

I already was able to compile w/o error. However, even everything well with the desktop compiled version, on the device happens a error when i select the first filter. Anyonee could test please?

Thanks
 
Last edited:

outlawz

Member
Licensed User
What is the error message?

Hi Erel, I was able to compile sucessfully, i uninstalled all i had from Frameworks and installed the first 2 links from your web site.

Now i´m having problems to understand your editable routine. In the code i attach i´m having problems with:

1- set column width, i don´t know in which part of the code to put the column width lines;

2- Update the record were i changed the value. I did as you said and created a primary field called IDPK. I tough i could use your routine to validate value:

Sub Validate(column, value)
If column = "conta" AND Not(IsNumber(value)) Then
Msgbox("Valor tiene de ser numerico!")
Return False
Else
Return True
End If
End Sub


I don´t even know were you call the routine. If i can do the update query here will be great. I have the column name and the value, with the primary field i can make a update query because i know the exact location.
I want to update immediately after the value been input.
Can you help me?

Thanks

PS: I can´t upload database, is too big. Do you think you can help without it? I guess you can, probably you can help just looking.
 

Attachments

  • Inventario.zip
    5.4 KB · Views: 196
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Change the column widths after the ExecuteTable method:
B4X:
'Executes the SQL command
Sub Button1_Click
cmd.CommandText = filtrosql
'Executes the user query and fills the table with the result.
cmd.ExecuteTable("table1",0) 'Limits the number of rows to 500 (change to 0 for unlimited)
<- here
End Sub

The validate routine will be called whenever the user presses on the little X button.
It is called from the table module (btnAccept_Click).
I think that it is a good place to update your database. Note that the change to the table will only be set after this sub.
 

Cableguy

Expert
Licensed User
Longtime User
Hi Pedro,

Sorry for my late response...
You seem to be going in a good direction, but it would also be helpfull to know exactly what is that you need your app to do in order to tell what been done wrong...
If not so, we will only be able to help with error messages, and NOT with acompleshing a particular task...
 

outlawz

Member
Licensed User
Hi Paulo, don´t ask sorry please, you have a life besides my newbie questions. Regarding the opinion that i asked you, what i need from the code is exactly what you can see on the code i post. I need now to discover how to update the database, Erel gave me some lights, i hope i get it done by tomorrow. I asked for you, if you can of course, take a look and, based on your experience, give me your opinion and tell me what i can improve. Be though please.
After update then i must think how i will export to a file, but that i already saw some topics here on forum.

Thanks to be here Paulo. Regards.
 

JOTHA

Well-Known Member
Licensed User
Longtime User
Just a little question:

How can I make the RowID visible. I mean I want to read the RowID and show it.

Can anyone tell me please?

Thank you in advance!
 
Top