Advertisement

08.06.2008 at 09:26AM PDT, ID: 23626292
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.1

How to call a Sybase Stored Procedure from an Access application (mdb file) that resides on a Network drive ?

Asked by zimmer9 in Sybase Database, Access Coding/Macros

I have created an Access application using an mdb file that resides on my local C: drive and the application works fine. This application calls a Sybase Stored Procedure for which I do not have the ability to update.
The Sybase Stored Procedure is in the attached code snippet.
I use the following ODBC configuration for the Sybase connection:
********************************************************************************************************************
ODBC Data Source Administrator
User DSN tab
User Data Sources:  
Name                             Driver                                                               Add
PAP_ED                         DataDirect  4.0 Sybase Wire Protocol             Remove            
                                                                                                              Configure  <-- click on

4) ODBC Sybase Wire Protocol Driver Setup
    General tab
    Data Source Name         PAP_ED_TEST1
    Network Library Name   Winsock
    Network Address          nyuu,10467
    Database Name             a2query

    Test Connect button    <-- click on
   
    Logon to Sybase      
    Network Library                   WInsock      
    Network Address                nyuudb01,10467
    Login ID                                nitod
    Password                            ******
    Database                             a2query
**********************************************************************************************************************
In the attached code below the Stored Procedure is the code I use in the Access application to
retrieve the data from the Stored Procedure.

Do you know what revisions I would make to this application when I move it to a Network Drive
so that it will continue to work with the Sybase Stored Procedure ?

I tried to execute the application as is and I can successfully call the Sybase Stored Procedure when I execute the application from my local C: drive but when I execute this Access application from a Network drive, I DO NOT retrieve back any data from the Sybase Stored Procedure. Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
CREATE PROCEDURE getAccountRefData
(
    @application  varchar(15),
    @accountNumber char(9),
    @accountSystem int
)
AS
 
BEGIN
/*
************************************************************************
Dynamic SQL for MDA
************************************************************************
*/
declare @execCmd varchar(250),@fixParam varchar(2000),@param1 varchar(8000)
select @fixParam = '[UniqueExecutionID ='+newid(1)+'][ServerUserID='+convert(varchar,suser_id())+'][HostName='+host_name()+']'
select @execCmd=  ' exec getAccountRefData '
select @param1 = "@application="+case when @application is null then "NULL" else "'"+rtrim(@application)+"'" end +"," +
"@accountNumber="+case when @accountNumber is null then "NULL" else "'"+rtrim(@accountNumber)+"'" end +"," +
"@accountSystem="+case when @accountSystem is null then "NULL" else rtrim(convert(varchar,@accountSystem)) end
exec('--'+@fixParam+@execCmd+@param1)
 
/////////////////////////////////////////////////////////////////////
 
select DISTINCT TA.accountNumber, TA.accountSystemRN, TA.accountStatus, TA.accountCategoryRN,countryOfCitizenship, countryOfResidence,
       TGA.fullname1, TGA.address1, TGA.city, TGA.stateCode, RN.refName, TGA.postalCode
  from rdeTAPSAccount TA,
       TAPSGeneralAddress TGA,
       TAPSCustomerDesiStreetAccount TCDSA,
       refName RN
where TA.accountNumber = TCDSA.accountNumber
  and TA.accountSystemRN = TCDSA.accountSystemRN
  and TCDSA.accountNumber = TGA.accountNumber
  and TCDSA.accountSystemRN = TGA.accountSystemRN
  and TGA.mainAddressInd = 'Y'
  and TGA.countryCode = RN.refCode
  and TA.accountNumber = @accountNumber
  and TA.accountSystemRN = @accountSystem
 
  end
**************************************
There are 4 params as follows:
 
0 -  result  -  integer
1 -  @application
2 -  @accountNumber
3 -  @accountSystem
///////////////////////////////////////////////////////////////////////
Set oConn = CreateObject("ADODB.Connection")
 
oConn.Open "DSN=PAP_ED_RPT1;" & _
 "Uid=fsmainXX;" & _
 "Pwd=XXXXXX"
 
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
 
rst.Open "SELECT AccountNumber FROM tblNameAddress", CurrentProject.Connection
 
Do Until rst.EOF
 
Set cmd = New ADODB.Command
With cmd
    .ActiveConnection = oConn
    .CommandType = adCmdText
    .CommandText = "exec getTATGATCDSAByAccount @ApplnNm='test', @accountNumber='" & rst("AccountNumber") & "'"
    .CommandText = .CommandText & ",@accountSystem=1435,@selectFields='accountNumber, accountStatus"
    .CommandText = .CommandText & ", fullName1, address1, city, stateCode, postalCode, taxID, accountClassification"
    .CommandText = .CommandText & ", fullName2, countryCode, countryOfResidence, countryOfCitizenship, accountCategory"
    .CommandText = .CommandText & ", cashIndicator, marginIndicator, codIndicator'"
    Set recNameAdress = .Execute
End With
 
strAccountNumber = recNameAdress("accountNumber")
strFullName1 = Nz(recNameAdress("fullName1"), " ")
strFullName2 = Nz(recNameAdress("fullName2"), " ")
 
CurrentProject.Connection.Execute "Update tblNameAddress Set FullName1 ='" & Replace(strFullName1, "'", "''") & "', " & _
"statecode ='" & strStateCode & "', postalcode ='" & strpostalCode & "', taxID ='" & strtaxID & "', "  
    
recNameAdress.Close
 
rst.MoveNext
Loop
[+][-]08.06.2008 at 09:49AM PDT, ID: 22172277

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.06.2008 at 10:18AM PDT, ID: 22172555

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.06.2008 at 10:35AM PDT, ID: 22172749

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.06.2008 at 11:16AM PDT, ID: 22173219

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.06.2008 at 11:21AM PDT, ID: 22173278

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.06.2008 at 04:21PM PDT, ID: 22176230

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Sybase Database, Access Coding/Macros
Sign Up Now!
Solution Provided By: Joe_Woodhouse
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628