Hello I have the following problem and I can't solve it.
With DbCommand
I'm trying execute this SQL statement
Dim strCommnad As String =
"CREATE DEFAULT [dbo].[DOMAIN_XLibPKID_D] AS (0);" + Environment.NewLine +
"CREATE TYPE [dbo].[XLibPKID] FROM BIGINT NOT NULL;" + Environment.NewLine +
"EXEC sp_bindefault 'DOMAIN_XLibPKID_D', 'XLibPKID';"
command.CommandText = strCommnad
command.CommandType = CommandType.Text
command.ExecuteNonQuery()
but I always get this an error message
Incorrect syntax near the keyword 'CREATE'.
But when I run each command from strCommand
standalone then everything works fine.
I'm using VS 2010 Professional and SQL Server 2008 R2 Express.
Thanks for any help.