Hi, I have the following script
CREATE TABLE [dbo].[ErrorLog]([ErrorLogID] [int] IDENTITY(1,1) NOT NULL,[ErrorTime] [datetime] NULL, [UserName] [nvarchar](128) NULL,[ErrorNumber] [int] NOT NULL,[ErrorSeverity] [int] NULL,[ErrorState] [int] NULL,[ErrorProcedure] [nvarchar](126) NULL,[ErrorLine] [int] NULL,[ErrorMessage] [nvarchar](4000) NOT NULL) ON [PRIMARY]
Go
CREATE TABLE [dbo].[ErrorLog1]([ErrorLogID] [int] IDENTITY(1,1) NOT NULL,[ErrorTime] [datetime] NULL, [UserName] [nvarchar](128) NULL,[ErrorNumber] [int] NOT NULL,[ErrorSeverity] [int] NULL,[ErrorState] [int] NULL,[ErrorProcedure] [nvarchar](126) NULL,[ErrorLine] [int] NULL,[ErrorMessage] [nvarchar](4000) NOT NULL) ON [PRIMARY];
Go
Alter Table ErrorLog1 add col1 varchar(80)
Go
CREATE TABLE [dbo].[ErrorLog22]([ErrorLogID] [int] IDENTITY(1,1) NOT NULL,[ErrorTime] [datetime] NULL, [UserName] [nvarchar](128) NULL,[ErrorNumber] [int] NOT NULL,[ErrorSeverity] [int] NULL,[ErrorState] [int] NULL,[ErrorProcedure] [nvarchar](126) NULL,[ErrorLine] [int] NULL,[ErrorMessage] [nvarchar](4000) NOT NULL) ON [PRIMARY];
Go
Now I want to execute them from my C# code and find out all of the table name which are fail and which are success, here are the code which I am using:
scriptText = File.ReadAllText(lblFilePath.Text);
sqlConnection = new SqlConnection(connectionString);
svrConnection = new ServerConnection(sqlConnection);
server = new Server(svrConnection);
server.ConnectionContext.ExecuteNonQuery(scriptText);
sqlConnection.Close();
svrConnection.Disconnect();