數據庫系統中的資料加密

declare @pass varbinary(256)
select @pass=pwdencrypt('lsok')
select @pass
select pwdcompare('lsok',@pass)

如果pwdcompare返回1﹐表示口令正確﹐等于0則不正確。

说明:
pwdencrypt是加密函数,pwdCompare是比较函数返回1表示相等。

這里有一點要注意的是:pwdencrypt返回的數據類型是varbinary(256)

所以如果想使用pwdencrypt函數加密用戶密碼的話,則密碼欄位的數據類型一定要是varbinary(256) .否則在使用pwdcompare函數時,會出現錯誤.

不同數據庫資料的導入

07-27

Private Sub ActiveReport_ReportStart()rnDim strabcd As String '兵ンrnDim rsTemp As ADODB.RecordsetrnDim strRstJ As StringrnrnDim rs As ADODB.RecordsetrnDim Cnn2 As ADODB.ConnectionrnSet Cnn2 = New ADODB.ConnectionrnCnn2.CursorLocation = adUseClientrnCnn2.ConnectionTimeout = 30rnCnn2.CommandTimeout = 60rnCnn2.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=tool;Password=tool123;Data Source=BIAP\BISQL;"rn '本地數據庫rn Set rsTemp = cnn.Execute("select name from tempdb.dbo.sysobjects where name ='##LLPBabc'")rn If rsTemp.RecordCount > 0 Thenrn cnn.Execute ("Delete from ##LLPBabc")rn Elsern cnn.Execute ("create table ##LLPBabc(WADOCO nvarchar(8), DRDL01 nvarchar(30) ,WADCTO nvarchar(2) ,WAWR03 char(3),DCG datetime, WASRST char(2), UORG01 float, SOQS01 float , SOCN01 float)")rn End Ifrn rn'JDE資料暫存數據庫rn Set rs = Cnn2.Execute("select name from tempdb.dbo.sysobjects where name ='##LLPBabcd'")rn If rs.RecordCount > 0 Thenrn Cnn2.Execute ("Delete from ##LLPBabcd")rn Elsern Cnn2.Execute ("create table ##LLPBabcd(WADOCO nvarchar(8), DRDL01 nvarchar(30) ,WADCTO nvarchar(2) ,WAWR03 char(3),DCG datetime, WASRST char(2), UORG01 float, SOQS01 float , SOCN01 float)")rn End IfrnStrdate = Date - 1rnLabel18.Caption = Label18.Caption & StrdaternrnIf strA <> "" Thenrn strabcd = strabcd & " and " & "WADCTO = '" & strA & "'"rnEnd IfrnIf strB <> "" Thenrn strabcd = strabcd & " and " & "WADOCO = '" & strB & "'"rnEnd IfrnIf strC <> "" Thenrn strabcd = strabcd & " and " & "WASRST = '" & strC & "'"rnEnd IfrnIf strD <> "" Thenrn strabcd = strabcd & " and " & "WAWR03 = '" & strD & "'"rnEnd Ifrnrnrn'獲取暫存數據庫資料rnstrRST_SQL = " select WADOCO,DRDL01,WADCTO,WAWR03,DCG,WASRST, sum(UORG) as UORG,sum(SOQS) as SOQS ,sum(SOCN) as SOCN" & _rn " from WorkOrderF4801 inner join UserDefinedCodesF0005 on WorkOrderF4801.WAWR03=UserDefinedCodesF0005.DRKY and DRSY='00' and DRRT='W3' " & strabcd & " group by WADOCO,WADCTO,WAWR03,DCG,WASRST,DRDL01"rnSet rs = Cnn2.Execute(strRST_SQL)rn If rs.RecordCount > 0 Thenrn rs.MoveFirstrn Do While Not rs.EOFrn strRST_SQL = " insert into ##LLPBabcd (WADOCO,DRDL01,WADCTO,WAWR03,DCG,WASRST,UORG01,SOQS01,SOCN01) values('" & Trim(rs.Fields("WADOCO").Value) & "','" & Trim(rs.Fields("DRDL01").Value) & "','" & Trim(rs.Fields("WADCTO").Value) & "','" & Trim(rs.Fields("WAWR03").Value) & "','" & Trim(rs.Fields("DCG").Value) & "'," & Trim(rs.Fields("WASRST").Value) & ",'" & Trim(rs.Fields("UORG").Value) & "','" & Trim(rs.Fields("SOQS").Value) & "','" & Trim(rs.Fields("SOCN").Value) & "') "rn Cnn2.Execute strRST_SQLrn rs.MoveNextrn LooprnEnd Ifrnrn---問題所在rnGetRptdata Ado, "select WADOCO,DRDL01,WADCTO,WAWR03,DCG,WASRST,UORG01,SOQS01,SOCN01,sum(pb009)as pb009,sum(pb010)as pb010,sum(pb011)as pb011 from vwmJAPB " & _rn "inner join ##LLPBabc on vwmJAPB.pb001=##LLPBabc.WADCTO Collate Chinese_Taiwan_Stroke_CI_AS and vwmJAPB.pb003=##LLPBabc.WADOCO Collate Chinese_Taiwan_Stroke_CI_AS group by WADOCO,DRDL01,WADCTO,WAWR03,DCG,WASRST,UORG01,SOQS01,SOCN01 " & _rn " order by WADOCO,WADCTO,WAWR03 ", cnnrnrnEnd Subrnrn因為是2個數據庫,抓取的JDE資料已經放入到暫存數據庫臨時表##LLPBabcd中,後面DAO需要與本地數據庫連接vwmJAPB,不可能實現。rn所以我希望將暫存在##LLPBabcd到進本地數據中,rn不知道有什麽辦法可以自動把暫存數據庫中的臨時表##LLPBabcd的信息導入到本地數據庫臨時表##LLPBabc中來。rnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试

关闭