How to execute sql script file in c# Windows application

Jun 7 2018 2:36 AM
1.Below is my MS sql script.
2.How can I insert it in database on button click. 
 
 
 
USE [MyBizBilling_V1]
 
GO
SET IDENTITY_INSERT [dbo].[MenuMaster] ON
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (1, 0, N'DASHBOARD.', N'Dashboard', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (2, 0, N'MASTER', N'', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (3, 0, N'PURCHASES', N'', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (4, 0, N'PRODUCT', N'', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (5, 0, N'INVOICE', N'', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (6, 0, N'ESTIMATION', N'', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (7, 0, N'REPORTS', N'', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (8, 0, N'GST REPORT', N'', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (9, 0, N'SETTING', N'', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (10, 0, N'MY ACCOUNT', N'', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (11, 2, N'CUSTOMER MASTER', N'CustomerMaster', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (12, 2, N'SUPPIER MASTER', N'SupplierMaster', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (13, 2, N'UNIT MASTER', N'UnitMaster', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (14, 2, N'PRODUCT COMPANY MASTER', N'ProductCompanyMaster', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (15, 2, N'PRODUCT GROUP MASTER', N'ProductGroupMaster', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (16, 2, N'USER MASTER', N'UserMaster', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (17, 2, N'MENU MASTER', N'MenuMaster', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (18, 2, N'USER ACCESS MASTER', N'UserAccess', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (19, 1, N'DASHBOARD', N'Dashboard', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (20, 3, N'ADD NEW PURCHASE INVOICE', N'InventoryMgmt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (21, 3, N'UPDATE EXISTING INVENTORY', N'PurchaseEdit', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (22, 3, N'SUPPLIER PAYMENT', N'PurPayment', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (23, 3, N'PURCHASE ORDER', N'PurchaseOrder', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (24, 3, N'DUPLICATE SUPPLIER PAYMENT RECEIPT', N'DuplicatePurPaymentReceipt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (25, 4, N'PRODUCT.', N'Product', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (26, 4, N'UPLOAD PRODUCT LIST', N'ExcelUploadProductList', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (27, 5, N'INVOICE.', N'BillGeneration', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (28, 5, N'UPDATE/CANCEL INVOICE', N'BillEdit', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (29, 5, N'INVOICE PAYMENT', N'Payment', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (30, 5, N'DUPLICATE INVOICE PAYMENT RECEIPT', N'DuplicatePaymentReceipt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (31, 6, N'ESTIMATION .', N'Estimation', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (32, 6, N'DUPLICATE ESTIMATION', N'DuplicateEstimation', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (33, 6, N'ESTIMATION REPORT', N'EstimationRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (34, 7, N'CUSTOMER MASTER REPORT', N'CustomerMasterRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (35, 7, N'SUPP&LIER MASTER REPORT', N'SupplierMasterRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (36, 7, N'BILL REPORT', N'BillRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (37, 7, N'BILL LEDGER REPORT', N'BillLedgerRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (38, 7, N'RECEIPT REPORT', N'ReceiptRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (39, 7, N'PRODUCT REPORT', N'ProductRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (40, 7, N'SUPPLIER LEDGER REPORT', N'PurchaseLedgerRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (41, 7, N'SUPPLIER PAYMENT REPORT', N'SupplierPaymentRecRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (42, 7, N'PURCHASE PRODUCT REPORT', N'PurchaseProductRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (43, 7, N'GST PURCHASE REPORT', N'GSTPurchaseRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (44, 7, N'GST SALES REPORT', N'GSTSalesRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (45, 7, N'PURCHASE PRODUCT NAME WISE REPORT', N'PurchaseProductNameWiseRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (46, 7, N'SALES PRODUCT REPORT', N'ProductSalesRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (47, 7, N'&CUSTOMER LAST VISIT REPORT', N'CustomerLastVisit', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (48, 7, N'BILL PENDING REPORT', N'PendingRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (49, 7, N'SUPPLIER PENDING REPORT', N'PurPendingRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (50, 10, N'COMPANY DETAILS', N'CompanyDtls', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (51, 10, N'CHANGE PASSWORD', N'ChangePasswordForm', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (52, 10, N'DATABASE &BACKUP', N'BackupForm', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (53, 10, N'LOGOUT', N'', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (54, 10, N'C&HANGE DATE FORMAT', N'', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (55, 5, N'CREDIT DEBIT NOTE SALES', N'CreditDebitNoteSales', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (56, 3, N'CREDIT DEBIT NOTE PURCHASE', N'CreditDebitNotePurchase', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (57, 10, N'CLEAN DATABASE', N'DatabaseCleanUp', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (58, 9, N'BILL CONFIG', N'SaleInvoiceConfig', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (59, 8, N'SALE GST REPORT', N'SellGSTRpt', CAST(N'2018-06-06' AS Date), 1)
INSERT [dbo].[MenuMaster] ([Menuid], [Parentid], [Manuname], [Formname], [MenuCreDate], [UserId]) VALUES (60, 8, N'PURCHASE GST REPORT', N'PurchaseGSTRpt', CAST(N'2018-06-06' AS Date), 1)
SET IDENTITY_INSERT [dbo].[MenuMaster] OFF
 
 

Answers (1)