【发布时间】:2018-10-19 08:12:08
【问题描述】:
我有一个网站,我做了 asp:button 并在数据库中添加了 asp:textbox 并且它起作用了。 但是当我尝试插入时,它对我不起作用。我正在尝试在 aspx.cs 中将 insert date.text 写入我的数据库,它正在查找它的 id,因为它是输入而不是 asp:textbox。
<td class="style4">
תאריך לידה:
</td>
<td class="style3">
<input id="date" type="Date" min="1905-01-01" max="2019-01-01" value="2018-01-01"/>
</td>
OleDbConnection connection = new OleDbConnection();
connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=F:\WebSites\MyWebsite\DataBase.mdb;Persist Security Info=False;";
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
command.CommandText = "insert into users (FirstName, LastName, Place, Email, UserName, Birthday) values('" + firstname.Text + "','" + lastname.Text + "','" + PlaceList.Text + "','" + MyEmail.Text + "','" + AccountText.Text + "','" + date.Text + "')";
command.ExecuteNonQuery();
我得到一个错误:
错误 29 名称“日期”不存在于当前 上下文 F:\WebSites\MyWebsite\Register.aspx.cs 27 242 F:\WebSites\MyWebsite\
没有找到这个id。
请问,谁能帮我解决? :(
【问题讨论】: