使用csharp更新组合框记录 [英] Update the combobox record using csharp
问题描述
数据库在Access中的结构如下;
名称文字
日文
设计如下;
名称组合框
日组合框
在名称列中,从数据库中检索所有名称并显示在组合框中。
在星期日到星期六的当天列日通过编码实际上。
在运行模式下。当我选择姓名和日期并单击保存按钮。记录保存在数据库中。
数据库记录如下
Suresh星期天
Suresh星期一
i有一个搜索按钮,当我点击搜索按钮,以上两条记录显示在datagridview中。
在datagridview记录中如下;
姓名日
Suresh星期天
Suresh星期一
当我点击datagridview中的第一个记录suresh时记录显示在组合框中。
假设我想更新第一条记录(suresh)星期日更改为星期五并点击更新按钮。数据库为suresh所有参赛日更新为星期五。但是我想更新周五第一次reocord。
输出如下;
Suresh星期五
Suresh星期五
但是我想在点击更新按钮后输出如下
Suresh周五
Suresh周一
如何更新。我怎么能使用csharp。
请帮帮我。
问候和谢谢,
Narasiman P.
Data base Structure as follows in Ms Access;
Name Text
Day Text
Design as follows;
Name Combo box
Day Combo box
In the name column,all names retrieved from the database and display into the Combo box.
In the day column day from sunday to saturday is maually by coding.
in the run mode. when i select the Name and Day and click the save button. the records are saved in the database.
in the database records as follows
Suresh Sunday
Suresh Monday
i have one search button, when i click the search button, the above two records are displayed in the datagridview.
In the datagridview records as follows;
Name Day
Suresh Sunday
Suresh Monday
when i click the first record suresh in datagridview the particular record is display in to the combobox.
in that suppose i want to update the first record (suresh) sunday changed in to friday and click the update button.in the database for suresh all entries day is updated into friday. but i want to update the friday for the first reocord only.
output as follows;
Suresh Friday
Suresh Friday
But i want the ouput as follows after click the update butotn
Suresh Friday
Suresh Monday
how to update.for that how can i do using csharp.
please help me.
Regards & Thanks,
Narasiman P.
推荐答案
检查更新语句中的WHERE子句;条件不应该用名字给出。而是在WHERE CLAUSE中使用主键。
Check your WHERE Clause in update Statement; condition should not be given by name. Instead use a Primary key in WHERE CLAUSE.
是的。 。 。 SNo应该是数据类型为Numeric / Integer的主键。
在列出详细信息时在Hiddenfield中获取SNo(从ToolBox控制)。
在更新的Where子句中使用相同的内容条款。
最初Hiddenfield将是空白的。其属性为.Value以保存文本。
Yeah. . . SNo should be Primary Key with datatype Numeric/Integer.
Fetch SNo in an Hiddenfield (Control from ToolBox) while listing the details.
used the same in Where Clause of Update Clause.
Initially Hiddenfield will be blank. And its Property is ".Value" to Save text in it.
这篇关于使用csharp更新组合框记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!