Adding MSSQL Database Objects to Crystal Report 11

Database objects is used to describe the various forms of data that can be added to a crystal report. Specifically, Crystal Reports can use the following types of database objects as data sources for a report:
■ Tables or system tables
■ Views
■ Synonyms
■ Stored procedures
■ SQL commands

Database objects are listed underneath connections in the Database Expert and are grouped by object type. The various database objects can be added to report by making connection to several database type such as Microsoft Access Database, ODBC, OLE DB and many more.  If you want to connect to your Microsoft SQL database so you must connect by OLE DB.

add crystal report database

Select OLE DB connection and then a pop up windows will show up.

add crystal report database 2

Select SQL Native Client and click next then a pop up windows will show up.

add crystal report database 3

Enter data source (server name), user id (MSSQL user id), password (MSSQL password) and database (MSSQL database). Click next if you success connecting Crystal report to MSSQL database then the image like this will show up.

add crystal report database 4

Click Finish to establish connection.

Stop watch game – python

These pyhton codes were made in python 2.7. I made these codes for making  simple stopwatch game in http://www.codeskulptor.org/. Just paste these codes to codeskulptor and you will see a pop up frame like in this image.  If you press the start button then stopwatch number will run until you press stop button. You will get score if you stop the stopwatch exactly on any number of point zero. stopwatch_game

# template for “Stopwatch: The Game”

import simplegui

# define global variables

milisec = 0
sec2 = 0
sec1 =0
minute = 0
success = 0
total = 0

# define helper function format that converts time
# in tenths of seconds into formatted string A:BC.D
def format():

global x,z, minute, sec1, sec2, milisec, success, total
x = str(minute)+”:”+str(sec1)+str(sec2)+”.”+str(milisec)
z = str(success)+”/”+str(total)

# define event handlers for buttons; “Start”, “Stop”,”Reset”

def start():

global y, w
timer.start()
y = timer.is_running()
w = True

def stop():

global y, w
w = False
print timer.is_running()
timer_handler()
timer.stop()
y = timer.is_running()

def reset():

global milisec, sec2, sec1, minute, success, total
milisec = 0
sec2 = 0
sec1 =0
minute = 0
success = 0
total = 0
timer.stop()

# define event handler for timer with 0.1 sec interval
def timer_handler():

global milisec, sec2, sec1, minute, total, success, w, y
print y, w
if (y == True) and (w == True):

if milisec <9:

milisec += 1

else:

milisec = 0
if sec2 <9:

sec2 += 1

else:

sec2 = 0

if sec1 <5:

sec1 += 1

else:

sec1 = 0
if minute == 9:

minute += 1
stop()

else:

minute += 1

elif (y == True) and (w == False):

if milisec == 0:

total += 1
success += 1
return total, success

else:

total += 1
return total

else:

return total

# define draw handler

def draw_handler(canvas):

global x,z
format()
canvas.draw_text(x, (90, 120), 60, ‘White’)
canvas.draw_text(z, (250, 30), 30, ‘Green’)

# create frame

frame = simplegui.create_frame(‘Stopwatch Game’, 300, 200, 300)
draw1 = frame.set_draw_handler(draw_handler)
button1 = frame.add_button(‘Start’, start, 200)
button2 = frame.add_button(‘Stop’, stop, 200)
button3 = frame.add_button(‘Reset’, reset, 200)

# register event handlers

timer = simplegui.create_timer(100, timer_handler)

# start frame

frame.start()