Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

VB.net Create a query inside an Access database

Hi. I am using the following VB.net code to create a view inside a SQL database.
What similar code would I use to create a query inside an Access database?


    Sub Create_SQL_View(ByVal oViewName As String, ByVal oSQL As String)
        Dim myConnection As SqlConnection = New SqlConnection(Globals.ThisAddIn.oRIGHT.lblConnectionString.Text)
        Dim myCommand As SqlCommand

        myConnection.Open()

        Dim S As String = "CREATE VIEW " & oViewName & " AS " & " " & oSQL

        myCommand = New SqlCommand(S, myConnection)
        myCommand.ExecuteNonQuery()

        myConnection.Close()
    End Sub
ASKER CERTIFIED SOLUTION
Avatar of Doug
Doug
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

Thanks very much