Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi all,
I have created a store procedure WITH ENCRYPTION as given below:

SQL
create proc #Show(@Value int, @EmpName varchar(50))
WITH ENCRYPTION
as
(
    select * from EmpDetails where (ImpId = @Value or @Value='') and (EmpName=@EmpName or @EmpName='')
)



I want to use this on my asp.net application how can i do this. I'm doing this as following:

VB
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

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.
Posted
Updated 30-Jun-12 3:13am
v6
Comments
Agustee 20-Jun-12 7:26am    
try by adding reference to Microsoft.sqlserver.SMO
Shahin Khorshidnia 20-Jun-12 8:25am    
Hi, I removed "soon". You must be patient. The experts are here because they like to and it's not their job.

1 solution

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.


SQL
create proc Show(@Value int, @EmpName varchar(50))
WITH ENCRYPTION
as
(
    select * from EmpDetails where (ImpId = @Value or @Value='') and (EmpName=@EmpName or @EmpName='')
)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900