Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27388

VS 2012 SQL get values from function

$
0
0
If I have the following SQL function:

Code:

CREATE FUNCTION usp_GetValueTesting
(
    @ID VARCHAR(10),
    @Description VARCHAR(10)
)
RETURNS VARCHAR(50)
AS

BEGIN
    return @ID + @Description
END

How can I get the result from this SQL function.

Here is some code that I have tried, but does not work:

Code:

        Dim SQLStatement As String = "EXEC usp_GetValueTesting '100' 'Test'"
        Dim DataSet As DataSet = DataBaseObject.ExecuteSQLStatementAndReturnDataSet(SQLStatement)

Code:

    Public Function ExecuteSQLStatementAndReturnDataSet(SQLStatement As String) As DataSet 'Execute SQL statements and return a dataSet
        Dim daRecords As New SqlDataAdapter(SQLStatement, DataBaseConnection)
        Dim dsRecords As New DataSet("Person")
        daRecords.FillSchema(dsRecords, SchemaType.Source, "Person")
        daRecords.Fill(dsRecords, "Person")
        Return dsRecords
    End Function


Viewing all articles
Browse latest Browse all 27388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>