Notice
Recent Posts
Recent Comments
Link
아미(아름다운미소)
sqlite3 레코드 추가/수정/삭제 본문
sqlite3 레코드 추가/수정/삭제시 Connection의 commit()함수 호출
# -*- coding:utf-8 -*-
import sqlite3
conn = sqlite3.connect('test.db')
conn.text_factory = str
cursor = conn.cursor()
cursor.execute("""
INSERT INTO testtable (NAME, PHONE, EMAIL)
VALUES(?, ?, ?)
""", ("테스트1", '010-3333-5555', 'aaa@naver.com'))
id = cursor.lastrowid
print(id)
cursor.execute("""
INSERT INTO testtable (NAME, PHONE, EMAIL)
VALUES(?, ?, ?)
""", ('테스트2', '010-5555-6666', 'bbb@gmail.com'))
id = cursor.lastrowid
print(id)
conn.commit()
cursor.close()
conn.close()
'데이타베이스 > SQLite' 카테고리의 다른 글
| sqlite소수점 자리수 및 표현법 (2) | 2018.10.28 |
|---|---|
| sqlite 나누기 연산시 무조건 정수로만 나오는 문제점 (0) | 2018.10.27 |
| SQLite 날자관련정리 (0) | 2018.10.23 |
| SQLite 날짜검색 (0) | 2018.10.19 |
| SQLite 날짜와 시간 (0) | 2018.10.11 |
Comments