--Setup
Create table dbo.SampleInvoice
(
SampleInvoiceID int identity(1,1) not null,
AsofDate datetime null,
[Amount] float not null,
userid nvarchar(255) null,
Source nvarchar(5)
)
create proc uspSampleInvoiceAdd
(
@asofdate datetime,
@amount float=null,
@userid nvarchar(255)=null,
@Source nvarchar(5)='ADO'
)
as
set nocount on
insert into SampleInvoice
(
AsofDate,
Amount,
UserId,
Source
)
values (@asofdate,@Amount,@userid,@Source)
-- test
exec uspSampleInvoiceAdd @asofdate='20160101',@amount=1.01,@userid='ut2998',@source='SQL'
select * from dbo.sampleinvoice
' Notify user of any errors that result from
' executing the query
If rstTitles.ActiveConnection.Errors.Count >= 0 Then
For Each Err In rstTitles.ActiveConnection.Errors
MsgBox "Error number: " & Err.Number & vbCr & _
Err.Description
Next Err
End If
Clean up resources ' clean up
If Not rstTitles Is Nothing Then
If rstTitles.State = adStateOpen Then rstTitles.Close
End If
Set rstTitles = Nothing
If Not Cnxn Is Nothing Then
If Cnxn.State = adStateOpen Then Cnxn.Close
End If
Set Cnxn = Nothing
No comments:
Post a Comment