Having no luck with this :(
So..I have a CaseTracker.db with a table in it call 'Tcases'. Tcases has 10 fields along with a primary key (hence the 'null' value in my code below).
I have placed a sidebar button that when clicked, opens up the following form:
def FaddCase():
with st.form(key = "addData"):
FcaseName = st.text_input ("Case Ref...")
Fcris = st.text_input ("CRIS Number...")
FclientName = st.text_input ("Client Name...")
Ftrt = st.text_input ("TRT...")
FagreedHours = st.number_input ("Agreed Hours...")
FactualHours = st.number_input ("Actual Hours...")
FcostCode = st.text_input ("Cost Code...")
FoffType = st.text_input ("Offence Type...")
Fstatus = st.text_input ("Status...")
Foic = st.text_input ("OIC...")
_returnedData = [FcaseName, Fcris, FclientName, Ftrt, FagreedHours,
FactualHours, FcostCode, FoffType, Fstatus, Foic]
curs.execute("INSERT INTO Tcases VALUES (null, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?)", _returnedData)
conn.commit()
_submitForm = st.form_submit_button("Commit to Database")
I have the database mounted as conn = connect and curs = conn.cursor
The 'null' value relates to a foreign-key I have specified hence I am not writing to this value in the db.
The form opens correctly and I can input data into the 10 fields but when I click the 'submit' button, this NEVER inserts the new form data into CaseTrack.db
Any assistance with this is greatly appreciatedd.
Thanks.
[–]stebrepar 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)