Tim Maxey .NET Technology Blog & Resources

Could not find stored procedure

I haven't had to use a direct call to a stored procedure in a long time, but came across the could not find stored procedure error. (And yes I had all security set fine). If I uncommented out the "commandType" it worked!

Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("myconnection").ConnectionString)
        Dim cmd As New SqlCommand
        Dim execStr As String = "EXEC dbo.InsertActivity " & userid
        cmd.CommandText = execStr
        'cmd.CommandType = CommandType.StoredProcedure DOES NOT WORK WITH THIS UNCOMMENTED, WEIRD
        cmd.Connection = conn
        conn.Open()
        cmd.ExecuteNonQuery()
        conn.Close()
        cmd.Dispose()


Feedback

No comments posted yet.


Post a comment





 

Please add 8 and 8 and type the answer here: