May-27-2020, 04:06 PM
I'm trying to append a tuple full of records into a dbf file that I received from a sql statement but it only produce one record in my tuple. This is my code:
try:
DbConnect = '***'
myDbConn = pymssql.connect("*********","********", "*************",DbConnect)
cursor = myDbConn.cursor()
cursor.execute("""select * from payrolldata where busdate>= %s and busdate<=%s ;""",(dteStartDate,m0weekend))
rows = cursor.fetchall() or []
for row in rows:
myTup = tuple(row)
Dbf = dbf.Table( 'microsdata.DBF', 'id N(7,0); StoNo C(4);BusDate C(20);Position C(20);Ssn C(11); R_HRS N(10,4); Ot_Hrs N(10,4); OthOt_Hrs N(10,4); Oth_Hrs N(10,4); Tips_Pd N(10,4); Tips_Chg N(10,4); Tips_Ind N(10,4); Tips_Dec N(10,4); FirstName C(20); LastName C(20); PayrollId C(10); PayRate N(10,4); RegPay N(10,4)')
Dbf.open(mode=dbf.READ_WRITE)
records = Dbf.append(myTup)
