使用C#在ASP.NET上使用ENCRYPTION调用存储过程 [英] Calling store procedure WITH ENCRYPTION on asp.net using c#
本文介绍了使用C#在ASP.NET上使用ENCRYPTION调用存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我创建了一个带有ENCRYPTION的存储过程,如下所示:
hi all,
I have created a store procedure WITH ENCRYPTION as given below:
create proc #Show(@Value int, @EmpName varchar(50))
WITH ENCRYPTION
as
(
select * from EmpDetails where (ImpId = @Value or @Value='') and (EmpName=@EmpName or @EmpName='')
)
我想在我的asp.net应用程序上使用它,我该怎么做.我正在执行以下操作:
I want to use this on my asp.net application how can i do this. I''m doing this as following:
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSearch.Click
Try
Dim daMyName As New SqlDataAdapter
Dim dsMyName As New DataSet
Dim SqlConnection = New SqlConnection("Data Source=localhost;Initial Catalog=shivkumar;Integrated Security=True;")
Dim myCommand As New SqlCommand("#Show", SqlConnection)
myCommand.CommandType = CommandType.StoredProcedure
SqlConnection.Open()
myCommand.Parameters.AddWithValue("@Value", txtId.Text)
myCommand.Parameters.AddWithValue("@EmpName", CStr(txtName.Text))
daMyName.SelectCommand = myCommand
daMyName.Fill(dsMyName)
GridView1.DataSource = dsMyName
GridView1.DataBind()
Catch ex As Exception
MsgBox(Convert.ToString(ex))
End Try
End Sub
如果我正在做一个简单的存储过程,使用otot加密,它将运行良好.但是,如果使用加密的存储过程,则会出现错误无法找到存储过程#show".
我怎么解决这个问题.请帮助我.
if I''m making a simple store procedure withot encryption it running fine. But if Using incrypted store procedure it is giving an error "unable to find store proc #show".
how can I solve this problem. please help me.
推荐答案
您好,您已经创建了一个临时存储过程,它的作用域仅限于该会话/窗口.尝试从存储过程名称中删除#.
Hi, you have created a temporary stored procedure, and it''s scope is limted to that session/window. try removing the # from the stored procedure name.
create proc Show(@Value int, @EmpName varchar(50))
WITH ENCRYPTION
as
(
select * from EmpDetails where (ImpId = @Value or @Value='') and (EmpName=@EmpName or @EmpName='')
)
这篇关于使用C#在ASP.NET上使用ENCRYPTION调用存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文