Error in SQL Server connection..

I want to retrieve data from SQL Server database…
But I have an error in sql server connection.

my server is - IROSHEN_PC
database name is - carparkDB

I got an error in line number 7…

1.from future import print_function
2.
3.import pypyodbc
4.
5.import datetime
6.
7.conn = pypyodbc.connect(‘DSN=IROSHEN-PC;Trusted_Connection=yes’)
8.
9.cur = conn.cursor()

Error: (u’IM002’, u’[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified’)

please help me to solve this…

You have a Microsoft operating system running on your Arduino?

Yes I have Microsoft operating system ......

This is my full code...

-- coding: utf-8 --

We use the Python 2.x & 3.x compatible print function.

from future import print_function

Let Python load it's ODBC connecting tool pypyodbc

import pypyodbc

Let Python load it's datetime functions

import datetime

Get a connection to MSSQL ODBC DSN via pypyodbc, and assign it to conn

conn = pypyodbc.connect('DSN=IROSHEN-PC;Trusted_Connection=yes')

Give me a cursor so I can operate the database with the cursor

cur = conn.cursor()

Create a sellout table in SQLServer

cur.execute('''CREATE TABLE sellout ( ID integer PRIMARY KEY IDENTITY, customer_name VARCHAR(25), product_name VARCHAR(30), price float, volume int, sell_time datetime);''')

I've made some changes to the data, make the changes take effective, Now!

cur.commit()

Insert a row to the sellout table

cur.execute('''INSERT INTO sellout(customer_name, product_name, price, volume, sell_time) VALUES(?,?,?,?,?)''',(u'江文', 'Huawei Ascend mate', '5000.5', 2, datetime.datetime.now()) )

Another change has been made. let that take effective, Now!

cur.commit()

Select those records about "Huawei" products

cur.execute('''SELECT * FROM sellout WHERE product_name LIKE '%Huawei%';''')

Print the table headers (column descriptions)

for d in cur.description: print (d[0], end=" ")

Start a new line

print ('')

Print the table, one row per line

for row in cur.fetchall(): for field in row: print (field, end=" ") print ('')

I have done all the things, you can leave me and serve for others!

cur.close() conn.close()

Yes I have Microsoft operating system ......

On which Arduino?

I fail to see how this is even remotely related to an Arduino programming issue.

I got it… I solve the Problem…
thank you for spent your valuable time for this…

This is the correct code for connect SQL Server Database…

conn = pypyodbc.connect(‘DRIVER={SQL Server};SERVER=IROSHEN-PC;DATABASE=EasyParkDB’)

At the risk of showing my age / ignorance, what language was that?