Python Forum
How do i read particular text from text file and update those values in MS SQL table
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do i read particular text from text file and update those values in MS SQL table
#14
I tried the below code..

but, it is showing error.

what is the problem in the below code..

cnxn = pyodbc.connect('DRIVER={SQL Server Native Client 11.0};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
cur = cnxn.cursor()
sql = "INSERT INTO test1 (EmpNo, Name, SAL) VALUES (%s, %s, %s)"
val = (Staff_no, Emp_name, emp_dept)
res = cur.execute(sql, val)
Reply


Messages In This Thread
RE: How do i read particular text from text file and update those values in MS SQL table - by ganeshsai2912 - Nov-15-2018, 02:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Picamera2 add text to camera preview GigiG 0 230 May-26-2025, 11:46 AM
Last Post: GigiG
  How can I write formatted (i.e. bold, italic, change font size, etc.) text to a file? JohnJSal 13 29,285 May-20-2025, 12:26 PM
Last Post: hanmen9527
  Paste text with caret already positioned inside a placeholder; Wehaveall 2 1,212 May-14-2025, 01:12 AM
Last Post: armorerratic
  subprocess check_output text cut off Axel_Erfurt 5 1,064 Feb-20-2025, 02:15 PM
Last Post: DeaD_EyE
  Python - Hidden Text / Html Mail python1337 1 3,779 Feb-08-2025, 10:47 AM
Last Post: python1337
  Problems writing a large text file in python Vilius 4 1,242 Dec-21-2024, 09:20 AM
Last Post: Pedroski55
  How to read a file as binary or hex "string" so that I can do regex search? tatahuft 3 1,473 Dec-19-2024, 11:57 AM
Last Post: snippsat
  Get an FFMpeg pass to subprocess.PIPE to treat list as text file? haihal 2 1,246 Nov-21-2024, 11:48 PM
Last Post: haihal
  parsing a tree of text first the right most aligned blocks of text and so on arvindikchari 2 951 Nov-21-2024, 01:42 AM
Last Post: BashBedlam
Photo image generation with text style Belialhun 0 763 Oct-08-2024, 01:53 PM
Last Post: Belialhun

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020