0

我想从 url 运行一个函数。

我想运行的过程没有参数,用于调用我数据库中的存储过程。

这是我尝试过的:

> http://localhost:42137/Hlh_shares/RunJobClass/RunJob?
> http://localhost:42137/Hlh_shares/RunJobClass/RunJob

Imports Microsoft.VisualBasic
Imports System.Data

Public Class RunJobClass
    Public Sub RunJob()
        Dim conn As New SqlClient.SqlConnection
        Try

            conn.ConnectionString = ConfigurationManager.ConnectionStrings("conn").ConnectionString
            Dim cmd As New SqlClient.SqlCommand
            cmd.Connection = conn

            cmd.CommandText = "[spx_ShareTradingCycles]"
            conn.Open()
            cmd.ExecuteNonQuery()

        Catch ex As Exception
            Throw New Exception(ex.ToString)
        Finally
            conn.Close()

        End Try
    End Sub
End Class

我的班级位于: 在此处输入图像描述

4

0 回答 0