Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
Tags
- 맛집
- 유니티
- PyQt5
- javascript
- ASP
- flutter
- 다이어트
- tensorflow
- swift
- mssql
- Excel
- IOS
- sqlite
- 함수
- MS-SQL
- 날짜
- Unity
- MySQL
- port
- 라즈베리파이
- pandas
- 리눅스
- ubuntu
- PER
- urllib
- node.js
- GIT
- Linux
- PyQt
- python
Archives
아미(아름다운미소)
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