无法将aspx中的日期更新到MS-ACCESS表 [英] Can't update date in aspx to a MS-ACCESS table
本文介绍了无法将aspx中的日期更新到MS-ACCESS表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,我在更新数据类型时遇到问题
Hello I'm having problem with updating datatypes
我像这样将日期插入C#部分
I insert the date in the C# part like this
string strSQL = "INSERT into Frettir (CreatedBy,CreatedOn,Title,Description,Starts,Ends,CatId,SectionId,ArticleExt,Myndatexti,MyndUrAlbumi,NrMyndar) values(?,?,?,?,?,?,?,?,?,?,?,?)";
cmd.Parameters.Add("@Starts",OleDbType.Date).Value = dstartdate;
但是我像这样更新aspx部分
but I update in the aspx part like this
UpdateCommand="UPDATE [Frettir] SET [Title]=@Title,[Description]=@Description,[CreatedBy]=@notandaID,[ArticleExt]=@ArticleExt, [Myndatexti]=@Myndatexti,[Starts]=@Starts WHERE [ArticleID]=@id2 "
<UpdateParameters>
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="notandaID" Type="int16" />
<asp:Parameter Name="ArticleExt" Type="String" />
<asp:Parameter Name="Myndatexti" Type="String" />
<asp:Parameter Name="Starts" Type="DateTime" />
<asp:QueryStringParameter Name="id2" QueryStringField="ArticleID" Type="Int32" />
</UpdateParameters>
在标准表达式中出现错误数据类型不匹配似乎在c#部分输入的类型和aspx-part
I get an error Data type mismatch in criteria expression It seems that there are some type differences between the type that is input in the c# part and the aspx-part
有人可以帮我吗?
推荐答案
我只做过一次...我使用以下代码分配了值.
I just did it once... I assigned the valued using the following code..
com.Parameters.AddWithValue("EmpDoj", EmpDoj.ToShortDateString());
它为我工作..以为它也可以帮助您...
It worked for me.. Thought it could help you as well...
此外,我很想知道答案,为什么你的答案不起作用...
Further, I'm eager to know the answer, why yours was not working...
这篇关于无法将aspx中的日期更新到MS-ACCESS表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文