[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Code APPLICATION

Posted on 2009-04-06
2
Medium Priority
?
137 Views
Last Modified: 2012-05-06
How can i arrange this code to make a stored procedure?
I'm trying to make a stored procedure like an image below but i dont know if ist correct.
hope you correct this code!
Thanks..

CREATE PROCEDURE [dbo].[SOLDITEM] (
	[PCODE] [char] (16) NULL ,
	[PNAME] [char] (45) NULL ,
	[QUANTITY] [float] NULL ,
	[AMOUNT] [float] NULL ,
	[DISCOUNT] [float] NULL ,
	[PROFIT] [float] NULL ,
	[THEDATE] [datetime] NULL ,
	[SALESTYPE] [char] (1) NULL ,
	[TRXNO] [float] NULL ,
	[SOP] [float] NULL 
) ON [PRIMARY]
GO

Open in new window

grid.bmp
0
Comment
Question by:Whing Dela Cruz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
bmatumbura earned 1000 total points
ID: 24084274
What is the procedure supposed to do?
0
 

Author Comment

by:Whing Dela Cruz
ID: 24084373
Hi!
to exe.command

Public Function ChkSoldItem( _
    ByRef pCode As String, _
    ByRef TheDate As Date, _
    ByRef SALESTYPE As String) As Boolean
    
 
Dim cnn As ADODB.Connection
'On Error GoTo Handle_Err
 
  Const conProcName = conModuleName & _
    ".ReadCashier"
    
    Dim cmd As ADODB.Command
    Dim prms As ADODB.Parameters
    Dim rs As ADODB.Recordset
     
    Set cnn = New ADODB.Connection
    cnn.ConnectionString = conConnectionString
    cnn.Open
 
    If Not cnn.State = adStateOpen Then
      GoTo Exit_Here
  End If
 
' Create command objects
    Set cmd = New ADODB.Command
 
' Set command properties
With cmd
    Set .ActiveConnection = cnn
    .CommandText = "chksolditem"
    .CommandType = adCmdStoredProc
    Set prms = .Parameters
End With
 
    ' Define stored procedure prms and append to command.
    prms.Append cmd.CreateParameter("@pcode", adChar, adParamInput, 16)
    prms.Append cmd.CreateParameter("@thedate", adDate, adParamInput, 0)
    prms.Append cmd.CreateParameter("@salestype", adChar, adParamInput, 1)
    
    
    ' Insert a dummy customer
    prms("@pcode") = pCode
 
    prms("@thedate") = TheDate
    prms("@salestype") = SALESTYPE
 
    ' Execute the command
    Set rs = cmd.Execute
    With rs
        If .BOF = True And .EOF = True Then
            ChkSoldItem = False
        Else
            ChkSoldItem = True
        End If
        .Close
    End With
    ' Retrieve stored procedure return value and output parameters
Exit_Here:
  ' Ensure that connection is closed and released.
  If Not cnn Is Nothing Then
      If cnn.State = adStateOpen Then
          cnn.Close
      End If
      Set cnn = Nothing
  End If
  Exit Function
  
Handle_Err:
  Select Case Err.Number
    Case Else
        Err.Raise Err.Number, _
          conProcName, Err.Description, _
          Err.HelpFile, Err.HelpContext
  End Select
  Resume Exit_Here
  Resume
End Function

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question