问题描述
大家好,
我有一个表,其中包含字段Logid(primery key),名称,地址,EnteranceTime,LeaveTime
我想访问离开时间为空"和进入时间与当前时间的差小于我指定的持续时间"的记录.我正在尝试将当前时间和持续时间作为函数参数传递.问题是我无法正确传递参数.错误是参数不匹配.
SELECT登录ID,名称,地址,公司,EnteranceTime,LeaveTime,CardId
从EnteranceLog
(LeaveTime为NULL)和( EnteranceTime-?=?)
在C#中,我以这种方式调用查询
TimeSpan timespan = getduration();
this.enteranceLogMissingPersonsTableAdapter.Fill(this.enteranceLogDataSet.EnteranceLogMissingPersons,DateTime.Now.ToString(),timespan.ToString());
请指导我如何克服此错误
Hi Everybody,
I have a table with the fields Logid(primery key), Name, Address,EnteranceTime,LeaveTime
I want to access the records where the ''leavetime is null'' and ''difference of Enterance time and the current time is less than the time duration I specify''. I am trying to pass current time and the time duration as function parameters. Problem is I can''t pass the parameters right way. The error is parameters mismatch.
SELECT Logid, Name, Address, Company, EnteranceTime, LeaveTime, CardId
FROM EnteranceLog
WHERE (LeaveTime IS NULL) AND (EnteranceTime - ? = ?)
In c# I am calling the query this way
TimeSpan timespan = getduration();
this.enteranceLogMissingPersonsTableAdapter.Fill(this.enteranceLogDataSet.EnteranceLogMissingPersons, DateTime.Now.ToString (), timespan.ToString () );
please guide me how can I overcome this error
推荐答案
这篇关于按日期和时间选择,参数不匹配错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!