Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Use of external API in stored procedure?

Posted on 2007-04-02
3
Medium Priority
?
222 Views
Last Modified: 2012-05-05
This test code works in Visual Basic.net. It reads values from some cad-database through their API. ("Spider"-dll is registred on the test machine.) Is it possible to use the API from inside a stored procedure? Please provide sample code... :-)

    Sub Elsa_test()

        Dim spider As Object

        Dim sInterface As String
        Dim KT As Object
        Dim KTnumcols As Integer
        Dim i As Integer

        Const IPADDRESS = "192.168.10.65"
        Const PORT = "5010"
        Const CATALOGUE = "NORDO"


        sInterface = "SpiderX.ActiveX"


        'Sätter upp spiderX objektet / Create "spider" activeX.
        KT = CreateObject(sInterface)
        Call KT.Configure(IPADDRESS, PORT)

        'Testar om databasen går att öppna / Test if ELSA-database could be opened
        If Not KT.OpenTable(86, CATALOGUE, "") Then
            MsgBox("Could not open KT!")
            Exit Sub
        End If

        'Testar att gå till första raden i databasen / Test - move to the first record
        If Not KT.MoveFirst() Then
            MsgBox("Catalogue is empty!")
            Exit Sub
        Else

            Me.TextBox1.AppendText("Dä gick bra att öppna elsa-databasen.")
        End If


        'Läser in antal fält dvs kolumner i ELSA / read number of ELSA-columns
        KTnumcols = KT.GetNumberColumns
        For i = 1 To KTnumcols
            Me.TextBox1.AppendText(KT.GetColumnnamei(i - 1))
        Next

        'Loopar igenom databasen / loop all records
        While KT.GetNext()
            Me.TextBox1.AppendText((KT.GetValuei(1) + " : " + KT.GetValuei(2) + " : " + KT.GetValuei(3)))
        End While

    End Sub
0
Comment
Question by:davidsperling
[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
3 Comments
 
LVL 42

Accepted Solution

by:
dqmq earned 1000 total points
ID: 18836496
No, TSQL is not object languange.  However, you can develop some CLR subroutines based on those objects that are addressable from TSQL.   For example, you can call Elsa_Test from TSQL if you port if over to managed code.
0
 
LVL 4

Author Comment

by:davidsperling
ID: 18836574
Superb! Why didn't I figure it out myself!? Best of all, I have a book that descripes the procedure above right in my knees.

fyi... SQL Server 2005 Stored Procedure Programming In TSQ & .Net by Dejan Sunderic
0
 
LVL 4

Author Comment

by:davidsperling
ID: 18843840
As usual I ran into som security related problems posted here
http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL-Server-2005/Q_22488676.html

and here

http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL-Server-2005/Q_22489298.html

Is there a way to make the server Insecure By Default for test purposes!?
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

618 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