JackSparrow
10 years agoFrequent Contributor
facing an runtime python error "int object has no attribute split "
Hi All, Am trying to save the extracted data from the DB to a list but am facing the python runtime error "int object has no attribute split"
def TestProc():
AConnection = ADO.CreateADOConnection()
AConnection.ConnectionString = "Provider=MSDASQL.1;" + \
"Data Source=teachersDB";
AConnection.LoginPrompt = False
AConnection.Open()
RecSet = AConnection.Execute_('select empno from emptable')
RecSet.MoveFirst();
while not RecSet.EOF:
rows = RecSet.Fields.Item["empno "].Value
rows= rows.split(",")
Log.Message(rows)
RecSet.MoveNext()
AConnection.Close()
When am trying to convert from int to list or string to list also its not working Can anybody help me out
Try to update your code:
...
data_container = [] # create an empty list while not RecSet.EOF: rows = RecSet.Fields.Item["empno "].Value data_container.append(rows) # add retrieved value to the list RecSet.MoveNext()
...After the while loop will be completed, data_container list should contain all requested values from your table.
Try this:
Log.Message(str(data_container))
That is not the best solution, but it should help you to understand the output using Log.Message() method.