DB_Setting2Read + DB_Setting2Save

Reads and save setting into settings table per 2 IDs, similar to SettingRead and SettingSave
Setting is saved per EULID, which means same setting can be found for different EULID.
Can be used as (Setting per user id), (Setting per ProjectID), (Setting per ProgramID), ... etc

Function DB_Setting2Read(EULID, SettingID)
 If EULID = "" Then EULID="Global"
 If UCase(EULID)  = "GLOBAL"  Then EULID="Global"
 DB_Setting2Read   = "{{$N/A$}}"
 SQLSt      = "Select * from [FinishProduct_Settings] where [FinishProduct_EULID]='" & EULID & "' and [SettingName]='" & Str2DB(SettingID) & "' "
 Set recordsetF   = connection.execute(SQLSt)
 if recordsetF.eof Then exit function
 DB_Setting2Read   = trim(RecordSetF(3).value)
 Set RecordsetF   = nothing
End Function
Sub DB_Setting2Save(EULID, SettingID, SettingValueNew)
 If EULID = "" Then EULID = "Global"
 If UCase(EULID) = "GLOBAL" Then EULID="Global"
Found1      = DB_SettingRead(EULID, SettingID)
SQL2      = "Insert into FinishProduct_Settings ([FinishProduct_EULID],[SettingName],[SettingValue],DateUpdated) " & _
  "Values(N'" & EULID & "',N'" & Str2DB(SettingID) & "',N'" & Str2DB(SettingValueNew) & "','" & TimeinSQL & "')"
If Found1 <> "{{$N/A$}}" Then _
  SQL2     = "Update FinishProduct_Settings " & _
  "Set [SettingValue]=N'" & Str2DB(SettingValueNew) & "',DateUpdated='" & TimeinSQL & "' " & _
  "where [FinishProduct_EULID]='" & EULID & "' and [SettingName]='" & Str2DB(SettingID) & "'"
 connection.execute(SQL2)
End Sub

EULID, SettingID, SettingValueNew

Views 930 Downloads 331

'DB', 'Database', 'Setting', 'ANStr', 'ANString', 'ANStrList'

ANmarAmdeen
333
Database Classic ASP
Revisions

v2.0