- Create scripts from database for drop and create.
- Create stored procedure for the same with the code u have taken.
- Execute the stored procedure from code behind..
Drop and create query will be something like this..This is a sample..
/* Object: Table [dbo].[EmployeeList] Script Date: 09/12/2013 09:35:01 */
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EmployeeList]') AND type in (N'U'))
DROP TABLE [dbo].[EmployeeList]
GO
USE [dbname]
GO
/****** Object: Table [dbo].[EmployeeList] Script Date: 09/12/2013 09:35:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[EmployeeList](
[FirstName] [nvarchar](50) NULL,
[LastName] [nvarchar](50) NULL,
[Category] [nvarchar](50) NOT NULL,
[id] [int] IDENTITY(1,1) NOT NULL,
[alphanumeric] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO