• Welcome to SQLitening Support Forum.
 

News:

Welcome to the SQLitening support forums!

Main Menu

Saving Images Revisited - Best Practice

Started by Fredrick Ughimi, January 02, 2013, 10:44:26 PM

Previous topic - Next topic

Fredrick Ughimi

Hello,

I get "Statement Too Long/Complex" error with the statement below. Are there ways to shorten this?


slExeBind slBuildInsertOrUpdate("tblMembersBioData", "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & _
"?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & _
"?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & _
"?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & _
"?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?"), _ 
      slBuildBindDat(m_sTitle, "T") & _
      slBuildBindDat(m_sSurname, "T") & _
      slBuildBindDat(m_sOthernames, "T") & _     
      slBuildBindDat(m_sAgeGroup, "T") & _ 
      slBuildBindDat(m_sSex, "T") & _ 
      slBuildBindDat(m_sMaritalStatus, "T") & _
      slBuildBindDat(m_sSpouseName, "T") & _
      slBuildBindDat(SQLiteDate(m_sWeddingDate), "T") & _     
      slBuildBindDat(m_sNoOfChildren, "T") & _     
      slBuildBindDat(m_sEducationalLevel, "T") & _     
      slBuildBindDat(m_sOccupation, "T") & _ 
      slBuildBindDat(m_sInstitution, "T") & _ 
      slBuildBindDat(m_sLevel, "T") & _ 
      slBuildBindDat(m_sAddress, "T") & _ 
      slBuildBindDat(m_sArea, "T") & _ 
      slBuildBindDat(m_sPhoneNo, "T") & _ 
      slBuildBindDat(m_sEmail, "T") & _ 
      slBuildBindDat(m_sOfficeAddress, "T") & _ 
      slBuildBindDat(m_sOfficePhoneNo, "T") & _ 
      slBuildBindDat(m_sOfficeEmail, "T") & _ 
      slBuildBindDat(m_sConvertionYear, "T") & _ 
      slBuildBindDat(m_sWaterBaptised, "T") & _ 
      slBuildBindDat(m_sHolySpiritBaptised, "T") & _ 
      slBuildBindDat(m_sFormerChurchAttended, "T") & _ 
      slBuildBindDat(m_sHowLong, "T") & _ 
      slBuildBindDat(m_sNewConvertClass, "T") & _
      slBuildBindDat(m_sMembershipClass, "T") & _
      slBuildBindDat(m_sATS, "T") & _
      slBuildBindDat(m_sRIDS, "T") & _
      slBuildBindDat(m_sAttend, "T") & _
      slBuildBindDat(m_sUnit, "T") & _
      slBuildBindDat(m_sIntendedChurchUnit, "T") & _
      slBuildBindDat(m_sExtraInformation, "T") & _
      slBuildBindDat(m_sName1, "T") & _
      slBuildBindDat(m_sBirthdate1, "T") & _
      slBuildBindDat(m_sSex1, "T") & _
      slBuildBindDat(m_sName2, "T") & _
      slBuildBindDat(m_sBirthdate2, "T") & _
      slBuildBindDat(m_sSex2, "T") & _
      slBuildBindDat(m_sName3, "T") & _
      slBuildBindDat(m_sBirthdate3, "T") & _
      slBuildBindDat(m_sSex3, "T") & _
      slBuildBindDat(m_sName4, "T") & _
      slBuildBindDat(m_sBirthdate4, "T") & _
      slBuildBindDat(m_sSex4, "T") & _
      slBuildBindDat(m_sName5, "T") & _
      slBuildBindDat(m_sBirthdate5, "T") & _
      slBuildBindDat(m_sSex5, "T") & _
      slBuildBindDat(m_sName6, "T") & _
      slBuildBindDat(m_sBirthdate6, "T") & _
      slBuildBindDat(m_sSex6, "T") & _
      slBuildBindDat(m_sName7, "T") & _
      slBuildBindDat(m_sBirthdate7, "T") & _
      slBuildBindDat(m_sSex7, "T") & _
      slBuildBindDat(m_sName8, "T") & _
      slBuildBindDat(m_sBirthdate8, "T") & _
      slBuildBindDat(m_sSex8, "T") & _
      slBuildBindDat(m_sName9, "T") & _
      slBuildBindDat(m_sBirthdate9, "T") & _
      slBuildBindDat(m_sSex9, "T") & _
      slBuildBindDat(m_sPictureName, "T") & _
      slBuildBindDat(sPicture, "B")) 
'           
Fredrick O. Ughimi<br /><br />fughimi@gmail.com<br />- Freedom lies in being bold -- Robert Frost, Poet

cj

Separate the field string and the data string into two variables within the call to slExeBind.
Another way is using string builder

#INCLUDE "\sql\inc\sqlitening.inc"
FUNCTION PBMAIN () AS LONG
  LOCAL sFields AS STRING
  LOCAL sb AS ISTRINGBUILDERA
  sb = CLASS "STRINGBUILDERA"
  sFields = REPEAT$(61,"?"+$NUL) & "?"
  sb.add  slBuildBindDat("one", "T")
  sb.add  slBuildBindDat("two", "B")
  slExeBind(slBuildInsertOrUpdate("tblMembersBioData", sFields),sb.string)
END FUNCTION




"No email alerts being received"  Please often check back.

cj

#47

FUNCTION PBMAIN () AS LONG
  LOCAL sTable AS STRING
  LOCAL sField, sData AS ISTRINGBUILDERA
  sField = CLASS "STRINGBUILDERA"
  sData  = CLASS "STRINGBUILDERA"

  sTable = "tblMembersBioData"

  sField.add REPEAT$(61,"?"+$NUL)
  sField.add "?"

  sData.add  slBuildBindDat("one", "T")
  sData.add  slBuildBindDat("two", "B")

  slExeBind(slBuildInsertOrUpdate(sTable, sField.string),sData.string)
END FUNCTION


Another to have all calls to slExeBind in one place

FUNCTION PBMAIN () AS LONG
  tblMembersBioData
END FUNCTION
FUNCTION tblMembersBioData AS LONG
  LOCAL sTable AS STRING
  LOCAL sField,sData AS ISTRINGBUILDERA
  sField = CLASS "STRINGBUILDERA"
  sData  = CLASS "STRINGBUILDERA"
  sTable = "tblMembersBioData"
  sField.add REPEAT$(61,"?"+$NUL)
  sField.add "?"
  sData.add  slBuildBindDat("one", "T")
  sData.add  slBuildBindDat("two", "B")
  Bind sTable,sField.String,sData.String
END FUNCTION
FUNCTION Bind(sTable AS STRING, sField AS STRING, sData AS STRING) AS LONG
  slExeBind(slBuildInsertOrUpdate(sTable, sField),sData)
END FUNCTION







"No email alerts being received"  Please often check back.

Fredrick Ughimi

Thank you CJ.

But I am using PBWin9 for this project. PBWin9 don't have the ISTRINGBUILDERA function. ISTRINGBUILDERA started with PBWin10.
Fredrick O. Ughimi<br /><br />fughimi@gmail.com<br />- Freedom lies in being bold -- Robert Frost, Poet

Fredrick Ughimi

Hello,

With the code below I get error 25 - Bind Column Out Of Range:


sFields = "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?"
sFields & = $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?"
sFields & = $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" 
sFields & = $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?"
sFields & = $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?"
sFields & = $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?"

sData = slBuildBindDat(m_sTitle, "T") & _ 
slBuildBindDat(m_sSurname, "T") & _                   
slBuildBindDat(m_sOthernames, "T") & _     
slBuildBindDat(m_sAgeGroup, "T") & _ 
slBuildBindDat(m_sSex, "T") & _ 
slBuildBindDat(m_sMaritalStatus, "T") & _
slBuildBindDat(m_sSpouseName, "T") & _
slBuildBindDat(SQLiteDate(m_sWeddingDate), "T") & _     
slBuildBindDat(m_sNoOfChildren, "T") & _     
slBuildBindDat(m_sEducationalLevel, "T") & _     
slBuildBindDat(m_sOccupation, "T") & _ 
slBuildBindDat(m_sInstitution, "T") & _ 
slBuildBindDat(m_sLevel, "T") & _ 
slBuildBindDat(m_sAddress, "T") & _ 
slBuildBindDat(m_sArea, "T") & _ 
slBuildBindDat(m_sPhoneNo, "T") & _ 
slBuildBindDat(m_sEmail, "T") & _ 
slBuildBindDat(m_sOfficeAddress, "T") & _ 
slBuildBindDat(m_sOfficePhoneNo, "T") & _ 
slBuildBindDat(m_sOfficeEmail, "T") & _ 
slBuildBindDat(m_sConvertionYear, "T") & _ 
slBuildBindDat(m_sWaterBaptised, "T") & _ 
slBuildBindDat(m_sHolySpiritBaptised, "T") & _ 
slBuildBindDat(m_sFormerChurchAttended, "T") & _ 
slBuildBindDat(m_sHowLong, "T") & _ 
slBuildBindDat(m_sNewConvertClass, "T") & _
slBuildBindDat(m_sMembershipClass, "T") & _
slBuildBindDat(m_sATS, "T") & _
slBuildBindDat(m_sRIDS, "T") & _
slBuildBindDat(m_sAttend, "T") & _
slBuildBindDat(m_sUnit, "T") & _
slBuildBindDat(m_sIntendedChurchUnit, "T") & _
slBuildBindDat(m_sExtraInformation, "T") & _
slBuildBindDat(m_sName1, "T") & _
slBuildBindDat(m_sBirthdate1, "T") & _
slBuildBindDat(m_sSex1, "T") & _
slBuildBindDat(m_sName2, "T") & _
slBuildBindDat(m_sBirthdate2, "T") & _
slBuildBindDat(m_sSex2, "T") & _
slBuildBindDat(m_sName3, "T") & _
slBuildBindDat(m_sBirthdate3, "T") & _
slBuildBindDat(m_sSex3, "T") & _
slBuildBindDat(m_sName4, "T") & _
slBuildBindDat(m_sBirthdate4, "T") & _
slBuildBindDat(m_sSex4, "T") & _
slBuildBindDat(m_sName5, "T") & _
slBuildBindDat(m_sBirthdate5, "T") & _
slBuildBindDat(m_sSex5, "T") & _
slBuildBindDat(m_sName6, "T") & _
slBuildBindDat(m_sBirthdate6, "T") & _
slBuildBindDat(m_sSex6, "T") & _
slBuildBindDat(m_sName7, "T") & _
slBuildBindDat(m_sBirthdate7, "T") & _
slBuildBindDat(m_sSex7, "T") & _
slBuildBindDat(m_sName8, "T") & _
slBuildBindDat(m_sBirthdate8, "T") & _
slBuildBindDat(m_sSex8, "T") & _
slBuildBindDat(m_sName9, "T") & _
slBuildBindDat(m_sBirthdate9, "T") & _
slBuildBindDat(m_sSex9, "T") & _
slBuildBindDat(m_sPictureName, "T") & _
slBuildBindDat(sPicture, "B") 

slExeBind(slBuildInsertOrUpdate("tblMembersBioData", sFields), sData)

Fredrick O. Ughimi<br /><br />fughimi@gmail.com<br />- Freedom lies in being bold -- Robert Frost, Poet

cj

#50
Inserting 62 items into 61 fields.  Added one more " ?".

#INCLUDE "\sql\inc\sqlitening.inc"

FUNCTION PBMAIN AS LONG
  LOCAL sFields,sData, stemp AS STRING
  stemp = "?" + $NUL
  sFields = REPEAT$(61,stemp) + "?"  '62 fields
  stemp =  "(F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14,F15,F16,F17,F18,F19,F20," + _
           "F21,F22,F23,F24,F25,F26,F27,F28,F29,F30,F31,F32,F33,F34,F35,F36,F37,F38,F39,F40," + _
           "F41,F42,F43,F44,F45,F46,F47,F48,F49,F50,F51,F52,F53,F54,F55,F56,F57,F58,F59,F60,F61,F62)"
  slopen "junk.db3","C"
slexe  "create table if not exists  tblMembersBioData(F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14,F15,F16,F17,F18,F19,F20," + _
        "F21,F22,F23,F24,F25,F26,F27,F28,F29,F30,F31,F32,F33,F34,F35,F36,F37,F38,F39,F40,"                                     + _
        "F41,F42,F43,F44,F45,F46,F47,F48,F49,F50,F51,F52,F53,F54,F55,F56,F57,F58,F59,F60,F61,F62)"


sData = slBuildBindDat(m_sTitle$, "T") & _
slBuildBindDat(m_sSurname$, "T") & _
slBuildBindDat(m_sOthernames$, "T") & _
slBuildBindDat(m_sAgeGroup$, "T") & _
slBuildBindDat(m_sSex$, "T") & _
slBuildBindDat(m_sMaritalStatus$, "T") & _
slBuildBindDat(m_sSpouseName$, "T") & _
slBuildBindDat(m_sWeddingDate$, "T") & _
slBuildBindDat(m_sNoOfChildren$, "T") & _
slBuildBindDat(m_sEducationalLevel$, "T") & _
slBuildBindDat(m_sOccupation$, "T") & _
slBuildBindDat(m_sInstitution$, "T") & _
slBuildBindDat(m_sLevel$, "T") & _
slBuildBindDat(m_sAddress$, "T") & _
slBuildBindDat(m_sArea$, "T") & _
slBuildBindDat(m_sPhoneNo$, "T") & _
slBuildBindDat(m_sEmail$, "T") & _
slBuildBindDat(m_sOfficeAddress$, "T") & _
slBuildBindDat(m_sOfficePhoneNo$, "T") & _
slBuildBindDat(m_sOfficeEmail$, "T") & _
slBuildBindDat(m_sConvertionYear$, "T") & _
slBuildBindDat(m_sWaterBaptised$, "T") & _
slBuildBindDat(m_sHolySpiritBaptised$, "T") & _
slBuildBindDat(m_sFormerChurchAttended$, "T") & _
slBuildBindDat(m_sHowLong$, "T") & _
slBuildBindDat(m_sNewConvertClass$, "T") & _
slBuildBindDat(m_sMembershipClass$, "T") & _
slBuildBindDat(m_sATS$, "T") & _
slBuildBindDat(m_sRIDS$, "T") & _
slBuildBindDat(m_sAttend$, "T") & _
slBuildBindDat(m_sUnit$, "T") & _
slBuildBindDat(m_sIntendedChurchUnit$, "T") & _
slBuildBindDat(m_sExtraInformation$, "T") & _
slBuildBindDat(m_sName1$, "T") & _
slBuildBindDat(m_sBirthdate1$, "T") & _
slBuildBindDat(m_sSex1$, "T") & _
slBuildBindDat(m_sName2$, "T") & _
slBuildBindDat(m_sBirthdate2$, "T") & _
slBuildBindDat(m_sSex2$, "T") & _
slBuildBindDat(m_sName3$, "T") & _
slBuildBindDat(m_sBirthdate3$, "T") & _
slBuildBindDat(m_sSex3$, "T") & _
slBuildBindDat(m_sName4$, "T") & _
slBuildBindDat(m_sBirthdate4$, "T") & _
slBuildBindDat(m_sSex4$, "T") & _
slBuildBindDat(m_sName5$, "T") & _
slBuildBindDat(m_sBirthdate5$, "T") & _
slBuildBindDat(m_sSex5$, "T") & _
slBuildBindDat(m_sName6$, "T") & _
slBuildBindDat(m_sBirthdate6$, "T") & _
slBuildBindDat(m_sSex6$, "T") & _
slBuildBindDat(m_sName7$, "T") & _
slBuildBindDat(m_sBirthdate7$, "T") & _
slBuildBindDat(m_sSex7$, "T") & _
slBuildBindDat(m_sName8$, "T") & _
slBuildBindDat(m_sBirthdate8$, "T") & _
slBuildBindDat(m_sSex8$, "T") & _
slBuildBindDat(m_sName9$, "T") & _
slBuildBindDat(m_sBirthdate9$, "T") & _
slBuildBindDat(m_sSex9$, "T") & _
slBuildBindDat(m_sPictureName$, "T") & _
slBuildBindDat(sPicture$, "B")

slExeBind(slBuildInsertOrUpdate("tblMembersBioData", sFields), sData)

LOCAL columns,x AS LONG, s AS STRING
slSel "Select count(*) from tblMembersBioData"
columns = slGetColumnCount
DO WHILE slGetRow
   FOR x = 1 TO Columns
      s = s + slf(x) + ","
   NEXT
LOOP
? "Count " + LEFT$(s,-1),,"Count"

END FUNCTION










"No email alerts being received"  Please often check back.

Fredrick Ughimi

Hello CJ,

You are right and thanks once more. I like the way you used the repeat$() function.
Fredrick O. Ughimi<br /><br />fughimi@gmail.com<br />- Freedom lies in being bold -- Robert Frost, Poet

Fredrick Ughimi

Hello CJ,

Now it becomes a little complicated use the above routine for Editing (Updating) a record:


sFields = "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?"
sFields & = $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?"
sFields & = $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" 
sFields & = $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?"
sFields & = $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?"
sFields & = $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" & $Nul & "?" _
& $Nul & "?", "Title, Surname, Othernames, AgeGroup, Sex, MaritalStatus, SpouseName, WeddingDate, NoOfChildren, EducationalLevel, Occupation," & _
"Institution, Level, Address, Area, PhoneNo, Email, OfficeAddress, OfficePhoneNo, OfficeEmail, ConvertionYear , WaterBaptised, HolySpiritBaptised," & _
"FormerChurch, HowLong, NewConvertClass, MembershipClass, ATS, RIDS, Attend, Unit, IntendedChurchUnit, ExtraInformation, Name1, Birthdate1, Sex1," & _
"Name2, Birthdate2, Sex2, Name3, Birthdate3, Sex3, Name4, Birthdate4, Sex4, Name5, Birthdate5, Sex5, Name6, Birthdate6, Sex6, Name7, Birthdate7," & _
"Sex7, Name8, Birthdate8, Sex8, Name9, Birthdate9, Sex9, PicturePath, Picture" 



Of course a syntax error popped up.
Fredrick O. Ughimi<br /><br />fughimi@gmail.com<br />- Freedom lies in being bold -- Robert Frost, Poet

Fredrick Ughimi

Hello,

Can someone please guide me in the right direction. I need help with this. I have tried different things to come up the UPDATE version of the above routine. Here is my latest effort. I get parameter mismatch:


sFields = Repeat$(62,"?"+$Nul) & "?"

sFields2 = Build$("Date, Title, Surname, Othernames, AgeGroup, Sex, MaritalStatus, SpouseName, WeddingDate, NoOfChildren, EducationalLevel, Occupation,", _
"Institution, Level, Address, Area, PhoneNo, Email, OfficeAddress, OfficePhoneNo, OfficeEmail, ConvertionYear, WaterBaptised, HolySpiritBaptised,", _
"FormerChurch, HowLong, NewConvertClass, MembershipClass, ATS, RIDS, Attend, Unit, IntendedChurchUnit, ExtraInformation, Name1, Birthdate1, Sex1,", _
"Name2, Birthdate2, Sex2, Name3, Birthdate3, Sex3, Name4, Birthdate4, Sex4, Name5, Birthdate5, Sex5, Name6, Birthdate6, Sex6, Name7, Birthdate7,", _ 
"Sex7, Name8, Birthdate8, Sex8, Name9, Birthdate9, Sex9, PicturePath, Picture")

sData = slBuildBindDat(m_sDate, "T") & _
slBuildBindDat(m_sTitle, "T") & _ 
slBuildBindDat(m_sSurname, "T") & _                   
slBuildBindDat(m_sOthernames, "T") & _     
slBuildBindDat(m_sAgeGroup, "T") & _ 
slBuildBindDat(m_sSex, "T") & _ 
slBuildBindDat(m_sMaritalStatus, "T") & _
slBuildBindDat(m_sSpouseName, "T") & _
slBuildBindDat(SQLiteDate(m_sWeddingDate), "T") & _     
slBuildBindDat(m_sNoOfChildren, "T") & _     
slBuildBindDat(m_sEducationalLevel, "T") & _     
slBuildBindDat(m_sOccupation, "T") & _ 
slBuildBindDat(m_sInstitution, "T") & _ 
slBuildBindDat(m_sLevel, "T") & _ 
slBuildBindDat(m_sAddress, "T") & _ 
slBuildBindDat(m_sArea, "T") & _ 
slBuildBindDat(m_sPhoneNo, "T") & _ 
slBuildBindDat(m_sEmail, "T") & _ 
slBuildBindDat(m_sOfficeAddress, "T") & _ 
slBuildBindDat(m_sOfficePhoneNo, "T") & _ 
slBuildBindDat(m_sOfficeEmail, "T") & _ 
slBuildBindDat(m_sConvertionYear, "T") & _ 
slBuildBindDat(m_sWaterBaptised, "T") & _ 
slBuildBindDat(m_sHolySpiritBaptised, "T") & _ 
slBuildBindDat(m_sFormerChurchAttended, "T") & _ 
slBuildBindDat(m_sHowLong, "T") & _ 
slBuildBindDat(m_sNewConvertClass, "T") & _
slBuildBindDat(m_sMembershipClass, "T") & _
slBuildBindDat(m_sATS, "T") & _
slBuildBindDat(m_sRIDS, "T") & _
slBuildBindDat(m_sAttend, "T") & _
slBuildBindDat(m_sUnit, "T") & _
slBuildBindDat(m_sIntendedChurchUnit, "T") & _
slBuildBindDat(m_sExtraInformation, "T") & _
slBuildBindDat(m_sName1, "T") & _
slBuildBindDat(m_sBirthdate1, "T") & _
slBuildBindDat(m_sSex1, "T") & _
slBuildBindDat(m_sName2, "T") & _
slBuildBindDat(m_sBirthdate2, "T") & _
slBuildBindDat(m_sSex2, "T") & _
slBuildBindDat(m_sName3, "T") & _
slBuildBindDat(m_sBirthdate3, "T") & _
slBuildBindDat(m_sSex3, "T") & _
slBuildBindDat(m_sName4, "T") & _
slBuildBindDat(m_sBirthdate4, "T") & _
slBuildBindDat(m_sSex4, "T") & _
slBuildBindDat(m_sName5, "T") & _
slBuildBindDat(m_sBirthdate5, "T") & _
slBuildBindDat(m_sSex5, "T") & _
slBuildBindDat(m_sName6, "T") & _
slBuildBindDat(m_sBirthdate6, "T") & _
slBuildBindDat(m_sSex6, "T") & _
slBuildBindDat(m_sName7, "T") & _
slBuildBindDat(m_sBirthdate7, "T") & _
slBuildBindDat(m_sSex7, "T") & _
slBuildBindDat(m_sName8, "T") & _
slBuildBindDat(m_sBirthdate8, "T") & _
slBuildBindDat(m_sSex8, "T") & _
slBuildBindDat(m_sName9, "T") & _
slBuildBindDat(m_sBirthdate9, "T") & _
slBuildBindDat(m_sSex9, "T") & _
slBuildBindDat(m_sPictureName, "T") & _
slBuildBindDat(sPicture, "B")

slExeBind "UPDATE tblMembersBioData Set sFields,sFields2 WHERE RowID=" & sRecordNo 

Fredrick O. Ughimi<br /><br />fughimi@gmail.com<br />- Freedom lies in being bold -- Robert Frost, Poet

cj

#54
Compilable example:
slExeBind slBuildInsertOrUpdate   that inserts a record

Need example of using WHERE clause with slBuildInsertOrUpdate?



FUNCTION PBMAIN AS LONG
  LOCAL sFields, s AS STRING, x,columns,NumberOfColumns AS LONG
  NumberOfColumns = 4
  sFields = REPEAT$(NumberOfColumns-1,"?"+ $NUL) + "?"
  slopen "junk.db3","C":  slexe  "drop table if exists T1"
  slexe  "create table if not exists T1(F1,F2,F3,F4)"
  DIM sArray(1 TO NumberOfColumns) AS STRING
  FOR x = 1 TO NumberOfColumns
    sArray(x)=slBuildBindDat("Column " + FORMAT$(x),"T")
  NEXT
  slExeBind slBuildInsertOrUpdate("T1", sFields), JOIN$(sArray(),"")
  slSel "Select F1,F2,F3,F4 from T1"
  columns = slGetColumnCount
  DO WHILE slGetRow
    FOR x = 1 TO Columns: s = s + slf(x) + "|": NEXT:   s = s + $CR
  LOOP": ? s,,"Done"
END FUNCTION         
"No email alerts being received"  Please often check back.

Fredrick Ughimi

CJ,

I am done with the Insert (Save)  routine. I am only having problems with UPDATE (Edit) routine. That what my above failed routine is for. I need with the UPDATE (EDIT) routine.
Fredrick O. Ughimi<br /><br />fughimi@gmail.com<br />- Freedom lies in being bold -- Robert Frost, Poet

cj

#56
Making it easier for someone to reply with a smaller example
that includes the code to create the database.
Looking for the WHERE using  slBuildInsertOrUpdate with slExeBind.

Looked at the examples and they all insert records.


FUNCTION PBMAIN AS LONG
  LOCAL sFields, s AS STRING, x,columns,NumberOfColumns AS LONG
  NumberOfColumns = 4
  sFields = REPEAT$(NumberOfColumns-1,"?"+ $NUL) + "?"
  slopen "junk.db3","C":  slexe  "drop table if exists T1"
  slexe  "create table if not exists T1(F1,F2,F3,F4)"
  DIM sArray(1 TO NumberOfColumns) AS STRING
  FOR x = 1 TO NumberOfColumns
    sArray(x)=slBuildBindDat("Column " + FORMAT$(x),"T")
  NEXT
  slExeBind slBuildInsertOrUpdate("T1", sFields), JOIN$(sArray(),"")
  slSel "Select F1,F2,F3,F4 from T1"
  columns = slGetColumnCount
  DO WHILE slGetRow
    FOR x = 1 TO Columns: s = s + slf(x) + "|": NEXT:   s = s + $CR
  LOOP": ? s,,"Done"
END FUNCTION         
"No email alerts being received"  Please often check back.

Fredrick Ughimi

Hello CJ,

Yes is not compiling. My UPDATE routine for other modules are working fine. Just that the fields of this one is too long, so I get "too long/complex error". Here is the INSERT Routine that is compiling.


sFields = Repeat$(62,"?"+$Nul) & "?"

sData = slBuildBindDat(m_sDate, "T") & _
slBuildBindDat(m_sTitle, "T") & _ 
slBuildBindDat(m_sSurname, "T") & _                   
slBuildBindDat(m_sOthernames, "T") & _     
slBuildBindDat(m_sAgeGroup, "T") & _ 
slBuildBindDat(m_sSex, "T") & _ 
slBuildBindDat(m_sMaritalStatus, "T") & _
slBuildBindDat(m_sSpouseName, "T") & _
slBuildBindDat(SQLiteDate(m_sWeddingDate), "T") & _     
slBuildBindDat(m_sNoOfChildren, "T") & _     
slBuildBindDat(m_sEducationalLevel, "T") & _     
slBuildBindDat(m_sOccupation, "T") & _ 
slBuildBindDat(m_sInstitution, "T") & _ 
slBuildBindDat(m_sLevel, "T") & _ 
slBuildBindDat(m_sAddress, "T") & _ 
slBuildBindDat(m_sArea, "T") & _ 
slBuildBindDat(m_sPhoneNo, "T") & _ 
slBuildBindDat(m_sEmail, "T") & _ 
slBuildBindDat(m_sOfficeAddress, "T") & _ 
slBuildBindDat(m_sOfficePhoneNo, "T") & _ 
slBuildBindDat(m_sOfficeEmail, "T") & _ 
slBuildBindDat(m_sConvertionYear, "T") & _ 
slBuildBindDat(m_sWaterBaptised, "T") & _ 
slBuildBindDat(m_sHolySpiritBaptised, "T") & _ 
slBuildBindDat(m_sFormerChurchAttended, "T") & _ 
slBuildBindDat(m_sHowLong, "T") & _ 
slBuildBindDat(m_sNewConvertClass, "T") & _
slBuildBindDat(m_sMembershipClass, "T") & _
slBuildBindDat(m_sATS, "T") & _
slBuildBindDat(m_sRIDS, "T") & _
slBuildBindDat(m_sAttend, "T") & _
slBuildBindDat(m_sUnit, "T") & _
slBuildBindDat(m_sIntendedChurchUnit, "T") & _
slBuildBindDat(m_sExtraInformation, "T") & _
slBuildBindDat(m_sName1, "T") & _
slBuildBindDat(m_sBirthdate1, "T") & _
slBuildBindDat(m_sSex1, "T") & _
slBuildBindDat(m_sName2, "T") & _
slBuildBindDat(m_sBirthdate2, "T") & _
slBuildBindDat(m_sSex2, "T") & _
slBuildBindDat(m_sName3, "T") & _
slBuildBindDat(m_sBirthdate3, "T") & _
slBuildBindDat(m_sSex3, "T") & _
slBuildBindDat(m_sName4, "T") & _
slBuildBindDat(m_sBirthdate4, "T") & _
slBuildBindDat(m_sSex4, "T") & _
slBuildBindDat(m_sName5, "T") & _
slBuildBindDat(m_sBirthdate5, "T") & _
slBuildBindDat(m_sSex5, "T") & _
slBuildBindDat(m_sName6, "T") & _
slBuildBindDat(m_sBirthdate6, "T") & _
slBuildBindDat(m_sSex6, "T") & _
slBuildBindDat(m_sName7, "T") & _
slBuildBindDat(m_sBirthdate7, "T") & _
slBuildBindDat(m_sSex7, "T") & _
slBuildBindDat(m_sName8, "T") & _
slBuildBindDat(m_sBirthdate8, "T") & _
slBuildBindDat(m_sSex8, "T") & _
slBuildBindDat(m_sName9, "T") & _
slBuildBindDat(m_sBirthdate9, "T") & _
slBuildBindDat(m_sSex9, "T") & _
slBuildBindDat(m_sPictureName, "T") & _
slBuildBindDat(sPicture, "B") 

slExeBind(slBuildInsertOrUpdate("tblMembersBioData", sFields), sData)


I need the UPDATE code of the above INSERT code.
Fredrick O. Ughimi<br /><br />fughimi@gmail.com<br />- Freedom lies in being bold -- Robert Frost, Poet

cj

#58
Could you please post something that includes PBMAIN
and creates the database and table?

Does it create 63 fields?
"No email alerts being received"  Please often check back.

Fredrick Ughimi

CJ,

I am using PwrDev IDE. Besides the whole save routine is quite long and would need some conversion to direct PB codes to make it run under PB IDE. Is there something I need to explain?
Fredrick O. Ughimi<br /><br />fughimi@gmail.com<br />- Freedom lies in being bold -- Robert Frost, Poet