1. 程式人生 > >操作MySQL資料庫報出:Parameter index out of range (1 > number of parameters, which is

操作MySQL資料庫報出:Parameter index out of range (1 > number of parameters, which is

對MySQL進行insert操作,控制檯丟擲以下錯誤:Parameter index out of range (1 > number of parameters, which is 0)
除錯了半天后查詢資料後,問題就出在當設定引數時,沒有相應的問號與之匹配或者根本就沒有?號

 String sql = "insert into t_courler(UserId,CourlerTitle,CourlerContent,CourlerMoney,CourlerWeight) values(?,?,?,?,?)";

同時需要注意的是,sql語句中的’?’是英文的,很有可能這種小問題沒有注意到。?外也不要搞一對單引號,不然會當做引數傳入到set方法中。

相關推薦

操作MySQL資料庫報出Parameter index out of range (1 > number of parameters, which is

對MySQL進行insert操作,控制檯丟擲以下錯誤:Parameter index out of range (1 > number of parameter

java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).

今天在使用ssm框架寫mapper和資料庫對接的時候出現了這個問題 原SQL: SELECT admin.gly_name,admin.gly_email,admin.gly_tel,admin.gly_id ,permission.qx_name as r

Parameter index out of range (1 > number of parameters, which is 0)

今天在寫模糊分頁查詢的時候報錯如下: Caused by: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0). at co

mybatis Parameter index out of range (1 > number of parameters, which is 0)

今天遇到了一個有意思的問題,看錯誤資訊提示,好像是有個引數沒有匹配上,具體錯誤資訊如下: ### SQL: SELECT count(*) FROM (SELECT * FROM testTable) table_count ; SQL []; Param

Python3操作MySQL資料庫(驅動pymysql)

建庫建表 create database wuSir default character set utf8 collate utf8_general_ci; use wuSir; create table auth_info( aid int

java.sql.SQLException: Parameter index out of range (4 > number of parameters, which is 2).

背景: 在使用多執行緒測多個基站(一個基站下面多個手卡)的資料,雖然資料都接受沒有問題,但是報了這個錯誤。 java.sql.SQLException: Parameter index out of range (4 > number of paramet

Caused by: java.sql.SQLException: Parameter index out of range (2 > number of parameters, which is 1

情景: mybatis語句 AND (p.times_limited='NO' OR (p.times_limited='YES' AND times LIKE '%#{times}%')) 異常

java.sql.SQLException: Parameter index out of range (3 > number of parameters, which is 2).

java.sql.SQLException: Parameter index out of range (3 > number of parameters, which is 2). at

報錯處理Python操作Mysql資料庫插入中文錯誤

學習《python網路爬蟲從入門到實踐》中遇到以下錯誤: Incorrect string value: '\xE7\xA8\x8B\xE5\xBA\x8F...' for column 'course' at row 1 出現這個錯誤的原因是,資料庫的編碼格式為latin1 而我要將utf

Mybatis異常解決之java.sql.SQLException: Parameter index out of range

mybatis使用過程中遇到下面一個異常: org.springframework.dao.TransientDataAccessResourceException: ### Error querying database. Cause: java.sql.SQLException: Param

python3基礎操作mysql資料庫

mysql登陸 基本操作: 登陸:mysql -uroot -h127.0.0.1 -P3306 -p mysql -uroot -p(本機不用寫host) 退出mysql:ctrl+z+回車,或者exit 埠號預設是3306,但是可以通過安裝目錄下的配置檔案修改。 使用流程

JAVA通過JDBC操作MySQL資料庫(三)PreparedStatement介面操作資料庫

JAVA通過JDBC操作MySQL資料庫(三):PreparedStatement介面操作資料庫 Statement介面的問題 PreparedStatement介面操作資料庫 Statement介面的問題 在文章JAVA通過JDBC操作

用php操作mysql資料庫在web頁面顯示查詢內容

初次學習用php操作資料庫,做一做筆記,簡單的總結一下如何在web介面輸出查詢內容和向資料庫中新增記錄。如有錯誤,望評論指正。 就是用php巢狀HTML程式碼,用一個table輸出。 在學習中遇到一些問題: 1.PHP無法向MYSQL插入中文記錄 如果在sql語句裡面插

mybatis中Parameter index out of range (1 > number of parameters, which is 0).

超出 myba dex 小白 轉載 tro index out mybatis Parameter index out of range (1 > number of parameters, which is 0).(參數索引超出範圍) 在mybatis裏面寫就是應該

jmeter操作mysql資料庫

1、安裝mysql的驅動包 · 為了連線mysql資料庫,還需要下載"mysql-connector-java.jar",可以從MySQL官網下載 新建測試計劃,載入jar包路徑,如下: 2、建立JDBC連線,並配置好資料連線、使用者名稱、密碼(請注意連線格式) 3、

python操作MySQL資料庫心得(numpy陣列寫入資料庫

    最近突發奇想,想把以前用Matlab實現的對高頻彩的開獎資料進行抓取並儲存到本地的專案重新用python做一遍。加上前段時間學習的MySQL,想將讀取回來的開獎資料存放到資料庫裡試試看。     廢話不多說,實操看看。 網頁下載器 這部分就

使用MySQLdb操作MySQL資料庫

#coding:utf-8 import MySQLdb # 1.連線資料庫 db = MySQLdb.connect('localhost','root','','students',charset='utf8') cur = db.cursor() # 2.插入資料 sq

nodejs(十七)操作mysql資料庫

var mysql = require('mysql') // 1. 建立連線 var connection = mysql.createConnection({ host: '192.168.94.151', user: 'root', password: 'root',

linux系統下操作mysql資料庫常見命令

一. 備份資料庫(如: test): ①可直接進入後臺即可.(MySQL的預設目錄:/var/lib/mysql ) ②輸入命令: [[email protected] mysql]# mysqldump -u root -p test>/home/bak/201

MySQL資料庫實驗任務一 建立資料庫和表

目錄 任務一 建立資料庫和表 【實訓目的與要求】 【實訓原理】 【實訓步驟】 一、熟悉MySQL環境 二、利用MySQL命令列視窗建立資料庫及表 三、利用介面工具建立資料庫及表 任務一 建立資料庫和表