Jump to content

Oracle - incorrect results


morvin
 Share

Recommended Posts

I am very new to AutoIT. I have version 3.2 (I think). I am trying to pull data from an Oracle 9i database. The following code is just for me to test and make sure I understand pulling the data from an ODBC datasource. It runs...pulls all correct data EXCEPT link. LINK is an 8 digit number. I've had it display the sql command it's running, and run the same command through SQL*Plus and get the correct value. I've figured out that the result I get for LINK is actually the value for LINK in the row prior to the row I'm pulling. Any ideas on what's wrong with the code? . Again, I KNOW the SQL part is correct. I've actually added more fields and all are correct, except LINK (it's the only numerical field in the table).

CODE
#include <GUIConstants.au3>

$UID = InputBox("User ID", "USER ID", "", "", 100, 100, 300, 300)

$PWD = InputBox("Password", "PASSWORD", "", "*", 100, 100, 300, 300)

$DSN = "DSN=HOME;UID=" & $UID & ";PWD=" & $PWD

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("AForm1", 633, 454, 193, 115)

$Input1 = GUICtrlCreateInput("", 112, 48, 121, 21)

GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

$Label1 = GUICtrlCreateLabel("EagleID", 56, 48, 56, 17)

GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

$Button1 = GUICtrlCreateButton("Get Student", 112, 72, 75, 25, 0)

$Input2 = GUICtrlCreateInput("", 312, 48, 185, 21)

GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

$Input3 = GUICtrlCreateInput("",112,100,121,21)

GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

$Label2 = GUICtrlCreateLabel("Name", 272, 48, 36, 17)

GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $Button1

$adoCon = ObjCreate("ADODB.Connection")

$adoCon.Open ($DSN)

$adoRs = ObjCreate("ADODB.Recordset")

$adoRs2 = ObjCreate("ADODB.Recordset")

$adoSQL1 = "Select link, name_lfm from ysamain where id ='" & GUICtrlRead($Input1) & "'"

$adoRs.CursorType = 2

$adoRs.LockType = 3

$adoRs.Open ($adoSQL1, $adoCon)

If Not $adoRs.eof Then

$PIDM = $adoRs.Fields (0).value

$Name = $adoRs.Fields (2).value

;$adoRs.close

GUICtrlSetData($Input2, $Name)

GUICtrlSetData($Input3, $adoRs.Fields (1).value)

Else

GUICtrlSetData($Input2, "Name Not Found")

EndIf

$adoCon.Close

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...