I like that idea about the __init__ function and will implement that 
Thanks!!!

I don't get any errors. I am just getting None returned in both the 
controller and shell even when hard codeing a SamAccountName that works 
within the Python shell. 
 

On Wednesday, August 5, 2015 at 4:48:03 PM UTC-4, Anthony wrote:
>
> How are you using this in web2py (i.e., where/how does get_GetEmployeeID 
> get called)? Do you get any errors? When you run the web2py shell, how are 
> you starting it, and are you using the same Python interpreter as when you 
> use the basic Python shell?
>
> Also, is the only difference between your two classes the hard-coded 
> database connection string? If so, why not using a single class and just 
> make the connection string an argument of the __init__ function?
>
> Anthony
>
> On Wednesday, August 5, 2015 at 4:17:04 PM UTC-4, David wrote:
>>
>> Here is the first part of the module I was reffering to:
>>
>> import pymssql
>>
>>
>> class HR_DB():
>>     def __init__(self):
>>         self.conn = pymssql.connect(DB Connection Info Removed)
>>
>>     def Execute(self, statement,*args):
>>         cursor = self.conn.cursor()
>>         cursor.execute(statement, args)
>>         result = cursor.fetchall()
>>         cursor.close()
>>         return result
>>
>>     def DestroyConnection(self):
>>         self.conn.close()
>>
>> class Coll_DB():
>>     def __init__(self):
>>         self.conn = pymssql.connect(DB Connection Info Removed)
>>
>>     def Execute(self, statement, *args):
>>         cursor = self.conn.cursor()
>>         cursor.execute(statement,args)
>>         result = cursor.fetchall()
>>         cursor.close()
>>         return result
>>
>>     def DestroyConnection(self):
>>         self.conn.close()
>>
>> def get_GetEmployeeID(SamAccountName):
>>
>>         conn = Coll_DB()
>>         rows = conn.Execute(SQL Removed)
>>         if len(rows) > 0:
>>             return(rows[0]['collid'])
>>         conn.DestroyConnection()
>>
>>
>>
>>
>> Again this works just fine calling it outside of web2py.
>>
>> if I run it from the interpreter on the server I am getting the correct 
>> id number. Even using the shell in web2py and issuing the same commands I 
>> am getting nothing. I feel like I am missing something simple
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to