asked on
Dim cn As New SqlConnection("Data Source=Main;Initial Catalog=Main;Persist Security Info=True;User ID=sa;Password=hello")
Dim command As New SqlCommand
Dim exec As SqlDataReader
command.Connection = cn
cn.Open()
Dim cmd As SqlCommand = New SqlCommand("[HeaderInsertCommand]", cn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New SqlParameter("@hdr", "[hdr]"))
cmd.Parameters.Add(New SqlParameter("@VendorID", "[VendorID]"))
cmd.Parameters.Add(New SqlParameter("@InvoiceDate", "[InvoiceDate]"))
cmd.Parameters.Add(New SqlParameter("@InvoiceNo", "[InvoiceNo]"))
cmd.Parameters.Add(New SqlParameter("@StoreNo", "[StoreNo]"))
cmd.Parameters.Add(New SqlParameter("@ItemNo", "[ItemNo]"))
cmd.Parameters.Add(New SqlParameter("@AmtDue ", "[AmtDue]"))
cmd.Parameters.Add(New SqlParameter("@TotalAmtDue", "[TotalAmtDue]"))
cmd.Parameters.Add(New SqlParameter("@SeqNo", "[SeqNo]"))
exec = cmd.ExecuteReader()
cn.Close()
ASKER
USE [Main]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- Description: Insert data to Header table
-- ================================================
ALTER PROCEDURE [dbo].[HeaderInsertCommand]
@hdr varchar(5) = NULL,
@VendorID varchar(5) = NULL,
--@InvoiceDate datetime = '2015-01-01 00:00:00.000',
@InvoiceDate nvarchar = NULL,
@InvoiceNo int = NULL,
@StoreNo nvarchar(255) = NULL,
@ItemNo int = NULL,
@AmtDue varchar(50) = NULL,
@TotalAmtDue money = NULL,
@SeqNo varchar(1) = NULL
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO AcadianaPepsiHeader (hdr, VendorID, InvoiceDate, InvoiceNo, StoreNo, ItemNo, AmtDue, TotalAmtDue, SeqNo )
VALUES (@hdr, @VendorID, @InvoiceDate, @InvoiceNo, @StoreNo, @ItemNo, @AmtDue, @TotalAmtDue, @SeqNo);
SELECT
'hdr' As [hdr]
,'1008' As [VendorID]
, CONVERT(DATETIME, [Invoice Date], 103) As [InvoiceDate]
,[Invoice Number] As [InvoiceNo]
,[Store Number] As [StoreNo]
,[Customer Number] As [ItemNo]
,SUM(ISNULL([Total], 2)) As [AmtDue]
,SUM(ISNULL([Total], 2)) As [TotalAmtDue]
,'1' As [SeqNo]
FROM [Pizza].[dbo].[AcadianaPepsiExcel]
where [Invoice Number] is not null
Group by
[Invoice Date]
,[Invoice Number]
,[Store Number]
,[Customer Number]
,[Total]
Order by [Store Number], [Total] DESC
END
ASKER
Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,
TRUSTED BY