Sub genExcelHQ()
Dim ds As New DataSet
ds = GetDataClaimReport(Me.tbStratDate.Text, Me.tbStopDate.Text) <<< // ต้องการรับค่ามาจากตัวนี้ครับ
Shared Function GetDataClaimReport(ByVal stDateTime As String, ByVal spDateTime As String) As DataSet <<// สับสนตรงนี้ครับ
Try
Dim strConn As String
strConn = "server=" & "192.168.1.1" & ";"
strConn &= "database=" & "DATABASE" & ";"
strConn &= "uid=" & "sa" & ";"
strConn &= "pwd=" & "password"
Dim sql As String
sql = "EXEC USP_RPT_REPORTJOB'" & stDateTime & "','" & spDateTime & "'"
Dim ds As New DataSet
Dim conn As New SqlConnection(strConn)
Dim cmd As New SqlCommand(sql, conn)
conn.Open()
cmd.CommandTimeout = 6000
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds)
'cmd.ExecuteNonQuery()
conn.Close()
Return ds
Catch ex As Exception
MsgBox(ex.Message)
Return Nothing
End Try
End Function