Vb.net存储过程 [英] Vb.net to store procedure

查看:66
本文介绍了Vb.net存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在存储过程中编写以下解密函数







函数描述(ByVal strval作为字符串)作为字符串

尝试

Dim i作为Int16,sting,first as As String

sting =

strval =修剪(strval)

对于i = 1到Len(strval)步骤2

first = Chr(Mid(strval,i,2)+ 20)

sting = sting&第一个

下一个

Decript = sting

Catch ex As Exception

MsgBox(Me,ex.Message.ToString )

Decript = Nothing

结束尝试

结束功能



我尝试过:



USE [TESTSMSOFT_CARS]

GO

/ ** ****对象:StoredProcedure [dbo]。[decryptpassword]脚本日期:04/18/2016 14:26:12 ****** /

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO



CREATE PROCEDURE [dbo]。[decryptpassword]( @pPassword varchar(max))



AS



BEGIN



选择转换(varchar(255),DecryptByPassPhrase('key',@ pPassword))





END

how to write the following decrypt function in stored procedure



Function Decript(ByVal strval As String) As String
Try
Dim i As Int16, sting, first As String
sting = ""
strval = Trim(strval)
For i = 1 To Len(strval) Step 2
first = Chr(Mid(strval, i, 2) + 20)
sting = sting & first
Next
Decript = sting
Catch ex As Exception
MsgBox(Me, ex.Message.ToString)
Decript = Nothing
End Try
End Function

What I have tried:

USE [TESTSMSOFT_CARS]
GO
/****** Object: StoredProcedure [dbo].[decryptpassword] Script Date: 04/18/2016 14:26:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[decryptpassword] ( @pPassword varchar(max))

AS

BEGIN

select convert(varchar(255),DecryptByPassPhrase('key', @pPassword ))


END

推荐答案

不要。

绝不以明文形式存储密码或加密密码 - 这是一个主要问题 安全风险。有关如何在此处执行此操作的信息:密码存储:如何做到这一点。 [ ^ ] - 它在C#而不是VB,但它非常简单,这里有一个转换器会改变语言:代码转换器|由Telerik提供 [ ^ ]
Don't.
Never store passwords in clear text, or encrypt them - it is a major security risk. There is some information on how to do it here: Password Storage: How to do it.[^] - it's in C# rather than VB, but it's pretty simple, and there is a converter here that will change the language: Code Converter | Provided by Telerik[^]


这篇关于Vb.net存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆