以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]加密解密  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=151288)

--  作者:lgj716330
--  发布时间:2020/6/19 15:21:00
--  [求助]加密解密
Dim N1 As Integer = e.Form.Controls("NF").value 
Dim N2 As Integer = N1-1
Dim Y1 As Integer = e.Form.Controls("YF1").value 
Dim Y2 As Integer = e.Form.Controls("YF2").value 
Dim HZ1 As String = e.Form.Controls("ZNBM").value 

DataTables("统计表").LoadFilter = "([年份] = \'" & N1 & "\' OR [年份] = \'" & N2 & "\') and [月份] >= \'" & Y1 & "\' and [月份] <= \'" & Y2 & "\'"
DataTables("统计表").Load

For Each dr As DataRow In DataTables("统计表").datarows
    dr("部门") = DecryptText(dr("部门"),"a23","op#")
    dr("职位") = DecryptText(dr("职位"),"a23","op#")
Next

DataTables("统计表").save()

Dim b As New SQLGroupTableBuilder("统计表1","统计表")
b.C
b.AddTable("统计表","部门编码","档案","部门编号") \'添加统计表
b.Groups.AddDef("年份")
b.Groups.AddDef("月份")
b.Groups.AddDef(HZ1)
b.Groups.AddDef("职位")
b.Groups.AddDef("姓名")
b.Totals.AddDef("合计") 
b.Filter ="(年份 = \'" & N1 & "\' OR 年份 = \'" & N2 & "\') and 月份 >= \'" & Y1 & "\' and 月份 <= \'" & Y2 & "\'"
b.Build()

提示以下错误
详细错误信息:
Base-64 字符串中的无效字符。



--  作者:lgj716330
--  发布时间:2020/6/23 11:18:00
--  
For Each dr As DataRow In DataTables("统计表").datarows
Dim bm As String = dr("部门") 
Dim zw As String = dr("职位") 
    dr("部门") = DecryptText(bm,"a23","op#")
    dr("职位") = DecryptText(zw,"a23","op#")
Next

前面解密的代码写错了,用以上代码解密是解决了,我想以同样的方式重新加密回去,会提示Base-64 字符串中的无效字符,是不是不能在客户端直接加密?
For Each dr As DataRow In DataTables("统计表").datarows
Dim bm1 As String = dr("部门") 
Dim zw1 As String = dr("职位") 
    dr("部门") = EncryptText(bm1,"a23","op#")
    dr("职位") = EncryptText(zw1,"a23","op#")
Next

--  作者:有点蓝
--  发布时间:2020/6/23 11:22:00
--  
判断一下单元格有没有数据再加密

if bm1>"" then dr("部门") = EncryptText(bm1,"a23","op#")