从URL调用过程(Sub)?

时间:2013-07-04 12:48:56

标签: vb.net 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

我的班级位于: enter image description here

0 个答案:

没有答案