My first attempt: (obviously not the whole query, but this is where its having issues)

Code:
Dim viewCreationString As String = "USE [" & databaseName & "];
                                            CREATE VIEW [dbo].[" & ProjectNameTextBox.Text & "_view] AS SELECT DISTINCT "

Error: 'CREATE VIEW' must be the first statement in a query batch.


My second attempt: (again not the whole query, but this is where its having issues)

Code:
 Dim viewCreationString As String = "USE [" & databaseName & "]
                                            GO
                                            SET ANSI_NULLS ON
                                            GO
                                            SET QUOTED_IDENTIFIER ON
                                            GO 
                                            CREATE VIEW [dbo].[" & ProjectNameTextBox.Text & "_view] AS SELECT DISTINCT "
Error: Incorrect syntax near 'GO'.

Incorrect syntax near 'GO'.

Incorrect syntax near 'GO'.