Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I signed up to your site to get help with a problem and I am so glad I did. I found the help I needed immediately. Thanks to all who contribute to your site..."

Geography

Where in the world do Tek-Tips members come from?

Extra connectivity to a SQL or MySQL database

tps14334 (TechnicalUser)
4 Aug 09 9:46
Does anyone have any examples or documentation on getting extra to connect to a SQL or MySQL database, including how to add, update, and move through the records?
SkipVought (Programmer)
4 Aug 09 10:19



Hi,

Extra cannot connect.  But you can write VBA code, using ADO to access you database.

this happens to be a function I wrote to return a value, but the principle is the same.  You just need a library reference to Microsoft ActiveX Data Object n.m Library

CODE

Function GetPartPriorty( _
        sPN As String) As String
'--------------------------------------------------
'SkipVought
'2007-08-02
'--------------------------------------------------
' Access: DB2.SFCS.READ
'--------------------------------------------------
':this function returns PRIPART for a given Part Number
'--------------------------------------------------

    Dim sConn As String, sSQL As String, sServer As String
    Dim rst As ADODB.Recordset, cnn As ADODB.Connection
    Dim lLineCtrl
    
    Set cnn = New ADODB.Connection
    
    sServer = "DB2OLEDB"
                 
    cnn.Open "Provider=MSDASQL.1;Persist Security Info=False;" & _
                "User ID=;" & _
                "Extended Properties=""DSN=Shadow Direct DB2P 32-bit;" & _
                "UID=;PORT=6800;HOST=mvsb1;SUBSYS=DB2P;CPFX=SHADOW;AT=YES;" & _
                "DP=%;AF=YES;MXBU=40960;AUST=NO;CNTM=120;"""

    
    Set rst = New ADODB.Recordset
    
'    sSQL = "SELECT Qty, Current_Op, Location, sf_cc, sf_oper, mach_grp "
    
    sSQL = "SELECT PRIPART "

    sSQL = sSQL & "FROM CAP.T_PART_NUMBER "
    
    sSQL = sSQL & "WHERE (PARTNO='" & Trim(sPN) & "')"
    
    rst.Open sSQL, cnn, adOpenStatic, adLockReadOnly, adCmdText
                          
    rst.MoveFirst
    
    
    If rst(0) <> "" Then
        GetPartPriorty = rst(0)
    End If

    rst.Close
    cnn.Close
    
    Set rst = Nothing
    Set cnn = Nothing
End Function
 

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close