Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Shared Function to return a DataView
Message
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Shared Function to return a DataView
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01163006
Message ID:
01163006
Views:
44
I am trying to create a function that can be called from anywhere in my code by passing it a SQL text statement, and having the function return a DataView. the word goView in the return statement has the blue underline and putting my mouse over it, it shows the following in a tooltip:
Value of type 'System.Data.DataView cannot be converted to '1-dimentional array of System.Data.Dataview'.
Hoping someone can help me out with this. My goal is to be able to make a function call from anywhere in the app, like:

dim oDataView as GetDataViewObject.GetDataView("Select * from meetings where meetingnumber = 12345")

Thanks for any help
Imports System.Data.SqlClient
Imports System.Data.OleDb
Public Class GetDataViewObject
    Public Shared Function GetDataView(ByVal tcSQLCMD As String) As Data.DataView()
        ' Define The Command Object 
        Dim oCommand As New OleDbCommand()
        oCommand.CommandText = tcSQLCMD
        oCommand.CommandType = CommandType.Text
        'Connect to Database
        oCommand.Connection = Globals.AppGlobals.oConn
        Dim goView As New Data.DataView()
        'Load the DataView
        goView = VFPToolkit.vfpData.SqlExecute(Globals.AppGlobals.oConn, oCommand, "DataAlias")
        VFPToolkit.vfpData.SqlDisConnect(Globals.AppGlobals.oConn)
        Return goView <<<<=== Error on this line 
    End Function
End Class
Next
Reply
Map
View

Click here to load this message in the networking platform