Sign in to follow this  
Followers 0
Guest kam

Need Help on string input to webcombo....PLEASE HELP

3 posts in this topic

Here is my Script

#include <IE.au3>

#include<ADO.au3>

$1DB = "my data base path"

$1Table = "my Table Name"

$M = _adoGetData($1DB, $1Table, "State", 3); state is the column name and 3 is the row number

$oIE1 = _IEAttach("url here", "URL")

$State = _adoGetData($1DB, $1Table, "State", 3)

_IE_SelectSetValue($oIE1, "ddlState", $State); ddlstate is the select object in web application

;*************Function to select value in webcomb object*********************

Func _IE_SelectSetValue( $oIE, $name, $value )

$oForm = _IEFormGetCollection( $oIE, 0 )

If IsObj($oForm) Then

$oSelect = _IEFormElementGetObjByName( $oForm, $name )

_IEFormElementOptionselect( $oSelect, $value )

EndIf

EndFunc

;****************Function to get data from database************************

Func _adoGetData($adSource, $adTable, $colName, $RowID)

Local $I, $Rtn, $sql, $str

$oADO = 'ADODB.Connection'

If IsObj($oADO) Then

$oADO = ObjGet('',$oADO)

Else

$oADO = _adoOpen($adSource)

EndIf

If IsObj($oADO) = 0 Then Return SetError(1)

$oRec = _adoOpenRecordset()

If IsObj($oRec) = 0 Then Return SetError(2)

$sql = "SELECT " & $colName & " FROM " & $adTable & " where ID = " & $RowID

;MsgBox(0, "", $sql)

;$oRec.Open ($sql, $oADO,"","")

$oRec.Open ($sql, $oADO, $adOpenStatic, $adLockOptimistic)

If $oRec.RecordCount < 1 Then

Return SetError(1)

Else

SetError(0)

;$str = $oRec.GetString()

$myRecords = $oRec.GetString()

;MsgBox(0, "",$str)

;$myRecords = StringSplit($str,Chr(29))

;MsgBox(0, "", $myRecords)

$oRec.Close()

$oADO.Close()

EndIf

Return $myRecords

EndFunc

_adoGetData is reading data from table, however Iam not able to input to the 'ddlstate' select object.

I tried passing value directly to $state (ex: $State = "LA"), it is working.

PLEASE PLEASE HELP.....

Share this post


Link to post
Share on other sites



SORRY HERE IS THE CORRECT SCRIPT

#include <IE.au3>

#include<ADO.au3>

$1DB = "my data base path"

$1Table = "my Table Name"

$oIE1 = _IEAttach("url here", "URL")

$State = _adoGetData($1DB, $1Table, "State", 3); state is the column name and 3 is the row number

_IE_SelectSetValue($oIE1, "ddlState", $State); ddlstate is the select object in web application

;*************Function to select value in webcomb object*********************

Func _IE_SelectSetValue( $oIE, $name, $value )

$oForm = _IEFormGetCollection( $oIE, 0 )

If IsObj($oForm) Then

$oSelect = _IEFormElementGetObjByName( $oForm, $name )

_IEFormElementOptionselect( $oSelect, $value )

EndIf

EndFunc

;****************Function to get data from database************************

Func _adoGetData($adSource, $adTable, $colName, $RowID)

Local $I, $Rtn, $sql, $str

$oADO = 'ADODB.Connection'

If IsObj($oADO) Then

$oADO = ObjGet('',$oADO)

Else

$oADO = _adoOpen($adSource)

EndIf

If IsObj($oADO) = 0 Then Return SetError(1)

$oRec = _adoOpenRecordset()

If IsObj($oRec) = 0 Then Return SetError(2)

$sql = "SELECT " & $colName & " FROM " & $adTable & " where ID = " & $RowID

;MsgBox(0, "", $sql)

;$oRec.Open ($sql, $oADO,"","")

$oRec.Open ($sql, $oADO, $adOpenStatic, $adLockOptimistic)

If $oRec.RecordCount < 1 Then

Return SetError(1)

Else

SetError(0)

;$str = $oRec.GetString()

$myRecords = $oRec.GetString()

;MsgBox(0, "",$str)

;$myRecords = StringSplit($str,Chr(29))

;MsgBox(0, "", $myRecords)

$oRec.Close()

$oADO.Close()

EndIf

Return $myRecords

EndFunc

_adoGetData is reading data from table, however Iam not able to input to the 'ddlstate' select object.

I tried passing value directly to $state (ex: $State = "LA"), it is working.

PLEASE PLEASE HELP.....

Share this post


Link to post
Share on other sites

SORRY HERE IS THE CORRECT SCRIPT

;...

$State = _adoGetData($1DB, $1Table, "State", 3); state is the column name and 3 is the row number

_IE_SelectSetValue($oIE1, "ddlState", $State); ddlstate is the select object in web application

;...

_adoGetData is reading data from table, however Iam not able to input to the 'ddlstate' select object.

I tried passing value directly to $state (ex: $State = "LA"), it is working.

PLEASE PLEASE HELP.....

I don't know that _adoGetData() function, but in SQLite, what you get back from query data is always an array containing one row's data, with an element for each selected column in the query. So your use of the variable $State (if it was the only column returned) would be:

_IE_SelectSetValue($oIE1, "ddlState", $State[0])

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
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
Sign in to follow this  
Followers 0