jeffrey.demulling at usbank.com
jeffrey.demulling at usbank.com
Mon Mar 13 10:34:51 CST 2006
Darren,
I use the following depending if the SP returns a record set or not.
No recordset
Public Sub DeleteEmployee(lngEmployeeNumber As Long)
'---------------------------------------------------------------------------------------
' Procedure : DeleteEmployee
' DateTime : 2006-Mar-08 12:49 12:49
' Author : Jeffrey F. Demulling
' Purpose :
'---------------------------------------------------------------------------------------
'
Dim con As New ADODB.Connection
Dim cmd As New ADODB.Command
On Error GoTo DeleteEmployee_Error
cmd.CommandText = "sproc_DELETE_Employee"
cmd.CommandType = adCmdStoredProc
con = setSQLServerConnectionApplication(2, 2)
con.Open
cmd.ActiveConnection = con
cmd.Parameters.Refresh
cmd(1) = lngEmployeeNumber
cmd.Execute
con.Close
Set con = Nothing
Set cmd = Nothing
On Error GoTo 0
Exit Sub
DeleteEmployee_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
DeleteEmployee of Module mdlEmployee"
End Sub
Return recordset
Public Function lngGetEmployeeNumber(strEmployeeName As String) As Long
'---------------------------------------------------------------------------------------
' Procedure : lngGetEmployeeNumber
' DateTime : 2006-Mar-10 10:14 10:14
' Author : Jeffrey F. Demulling
' Purpose :
'---------------------------------------------------------------------------------------
'
Dim con As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
On Error GoTo lngGetEmployeeNumber_Error
cmd.CommandText = "sproc_SELECT_Employee_Name_Number"
cmd.CommandType = adCmdStoredProc
con = setSQLServerConnectionApplication(1, 1)
con.Open
cmd.ActiveConnection = con
cmd.Parameters.Refresh
cmd(1) = strEmployeeName
Set rs = cmd.Execute
lngGetEmployeeNumber = rs.Fields("InternalEmployeeNumber")
rs.Close
con.Close
Set rs = Nothing
Set con = Nothing
Set cmd = Nothing
On Error GoTo 0
Exit Function
lngGetEmployeeNumber_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
lngGetEmployeeNumber of Module mdlEmployee"
End Function
Jeffrey F. Demulling
Project Manager
U.S. Bank Corporate Trust Services
60 Livingston Avenue
EP-MN-WS3C
St. Paul, MN 55107-2292
Ph: 651-495-3925
Fax: 651-495-8103
Pager: 888-732-3909
Text Messaging: 8887323909 at my2way.com
email: jeffrey.demulling at usbank.com
"Darren DICK"
<darrend at nimble.c
om.au> To
Sent by: "dba-SQL Server"
dba-sqlserver-bou <dba-sqlserver at databaseadvisors.com
nces at databaseadvi >
sors.com cc
Subject
03/12/2006 08:03 [dba-SQLServer] Running SQL SPROCS
PM from Access
Please respond to
dba-sqlserver at dat
abaseadvisors.com
Cross posted to dba-AccessD list
Hi All
Once I have made a connection to an SQL dB
Is there a way to execute SPROCS in that dB
Special code or special syntax etc?
Indeed - is there even a special connection routine needed - given the
latest
AccessD threads
on connecting with updatable connections (ADOB)
Many thanks in advance
DD
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com
------------------------------------------------------------------------------
Electronic Privacy Notice. This e-mail, and any attachments, contains information that is, or may be, covered by electronic communications privacy laws, and is also confidential and proprietary in nature. If you are not the intended recipient, please be advised that you are legally prohibited from retaining, using, copying, distributing, or otherwise disclosing this information in any manner. Instead, please reply to the sender that you have received this communication in error, and then immediately delete it. Thank you in advance for your cooperation.
==============================================================================