Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gosql.exec error #58

Closed
jingc1413 opened this issue Oct 17, 2023 · 2 comments
Closed

gosql.exec error #58

jingc1413 opened this issue Oct 17, 2023 · 2 comments

Comments

@jingc1413
Copy link

hi gosql.exec 不支持字段内容为空吗?

currTime := time.Now().Format("2006-01-02 15:04:05")
			_, err := gosql.Exec("update man_Task set tsk_state = %d, tsk_lasttime = '%s', tsk_nexttime = '%s' where tsk_Taskid= %d",
				TASKRUNING_STATE, currTime, "", 12)

image
把SQL 格式化后就可以正常执行

szSql := fmt.Sprintf("update man_Task set tsk_state = %d, tsk_lasttime = '%s', tsk_nexttime = '%s' where tsk_Taskid= %d",
				TASKRUNING_STATE, currTime, “”, 12)
		_, err := gosql.Exec(szSql)
		这里可以正常执行
@fifsky
Copy link
Member

fifsky commented Oct 17, 2023

currTime := time.Now().Format("2006-01-02 15:04:05")
			_, err := gosql.Exec("update man_Task set tsk_state = ?, tsk_lasttime = ?, tsk_nexttime = ? where tsk_Taskid=?",
				TASKRUNING_STATE, currTime, "", 12)

@jingc1413
Copy link
Author

currTime := time.Now().Format("2006-01-02 15:04:05")
			_, err := gosql.Exec("update man_Task set tsk_state = ?, tsk_lasttime = ?, tsk_nexttime = ? where tsk_Taskid=?",
				TASKRUNING_STATE, currTime, "", 12)

多谢,确实这样

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants