管理菜品的界面
1. 添加菜品通过 table中添加input text box实现
<asp:TableRow runat="server">
<asp:TableCell runat="server">菜品名称</asp:TableCell>
<asp:TableCell runat="server">菜品介绍</asp:TableCell>
<asp:TableCell runat="server">菜品详情</asp:TableCell>
<asp:TableCell runat="server">菜系</asp:TableCell>
<asp:TableCell runat="server">菜品图片路径</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server"><input type = "text" style ="width: 80%" id="newDishName" runat="server" /></asp:TableCell>
<asp:TableCell runat="server"><input type = "text" style ="width: 80%" id="newDishIntro" runat="server" /></asp:TableCell>
<asp:TableCell runat="server"><input type = "text" style ="width: 80%" id="newDishDetails" runat="server" /></asp:TableCell>
<asp:TableCell runat="server"><input type = "text" style ="width: 80%" id="newDishType" runat="server" /></asp:TableCell>
<asp:TableCell runat="server"><input type = "text" style ="width: 80%" id="newDishPic" runat="server" /></asp:TableCell>
</asp:TableRow>
2. 下面的展现通过bind gridview实现
3. 实现后效果
4.cs文件
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Reflection;
using System.Data;
using Common;
public partial class Admin_dishes : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataTable dt = dbOperation.GetAllDishes2();
this.GridViewDishes.DataSource = dt;
this.GridViewDishes.DataBind();
}
protected void GridViewDishes_RowEditing(object sender, GridViewEditEventArgs e)
{
this.GridViewDishes.EditIndex = e.NewEditIndex;
this.GridViewDishes.DataBind();
}
protected void GridViewDishes_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
this.GridViewDishes.EditIndex = -1;
this.GridViewDishes.DataBind();
}
protected void GridViewDishes_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string id = this.GridViewDishes.Rows[e.RowIndex].Cells[0].Text;
string dishName = ((System.Web.UI.WebControls.TextBox)(this.GridViewDishes.Rows[e.RowIndex].Cells[1].Controls[0])).Text;
string intro = ((System.Web.UI.WebControls.TextBox)(this.GridViewDishes.Rows[e.RowIndex].Cells[2].Controls[0])).Text;
string details = ((System.Web.UI.WebControls.TextBox)(this.GridViewDishes.Rows[e.RowIndex].Cells[3].Controls[0])).Text;
string sql = "update dish set dishName ='" + dishName + "',intro ='" + intro + "',details = '" + details + "' where dishId =" + id;
ExcuteSql(sql);
}
protected void GridViewDishes_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string id = this.GridViewDishes.Rows[e.RowIndex].Cells[0].Text;
string sql = "delete * from dish where dishId =" + id;
ExcuteSql(sql);
}
private void ExcuteSql(string sql)
{
if (dbOperation.ExcuteSql(sql) == -1)
{
Response.Write("<script>alert(\"命令"+sql+"运行失败\")</script>");
}
this.GridViewDishes.EditIndex = -1;
DataTable dt = dbOperation.GetAllDishes2();
this.GridViewDishes.DataSource = dt;
this.GridViewDishes.DataBind();
}
protected void ButtonAdd_Click(object sender, EventArgs e)
{
string dishName = this.newDishName.Value;
string intro = this.newDishIntro.Value;
string details = this.newDishDetails.Value;
string type = this.newDishType.Value;
string pic = this.newDishPic.Value;
string sql = "Insert into dish(dishName,intro,details,type,pic) Values('" + dishName + "','" + intro + "','" + details + "','" + type + "','" + pic + "')";
ExcuteSql(sql);
}
}
分享到:
相关推荐
- dish -> dishes - radio -> radios - photo -> photos - piano -> pianos - knife -> knives - leaf -> leaves - life -> lives - thief -> thieves - man -> men - woman -> women - child -> ...
dish -> dishes, radio -> radios, photo -> photos, piano -> pianos, knife -> knives, leaf -> leaves, life -> lives, thief -> thieves, man -> men, woman -> women, child -> children, foot -> feet, this ...
- dish -> dishes - half -> halves - deer -> deer (单复数同形) - child -> children - fish -> fish (单复数同形) 6. **名词的复数形式变回单数形式**: - wolves -> wolf - doctors -> doctor - cities...
- 以s, x, ch, sh结尾的词加-es,如:box -> boxes, fox -> foxes, dish -> dishes。 - 以辅音字母+y结尾的词,y变i再加-es,如:city -> cities, baby -> babies, fly -> flies。 - 以o结尾的词,一般加-s,但有...
- 以s, x, ch, sh结尾的名词加-es,如:dish -> dishes, fox -> foxes, branch -> branches。 - 以o结尾的名词,有生命的加-es,无生命的加-s,如:mouse -> mice, photo -> photos, piano -> pianos。 - 不规则...
- She is **doing** the dishes. - My brother is **making** kites. - My father is **reading** a new book. 以上是针对“PEP小学英语四种时态练习题及答案之欧阳学创编.pdf”中的部分内容进行的详细解析。...
2. **以s, x, ch, sh结尾的名词**:在词尾加-es,如:box -> boxes, bus -> buses, watch -> watches, dish -> dishes。 3. **以辅音字母+y结尾的名词**:改y为i再加-es,例如:baby -> babies, city -> cities。 ...
小升初英语语法是孩子们从小学过渡到初中的...Peach -> peaches, sandwich -> sandwiches, dish -> dishes, bus -> buses Man -> men, woman -> women 通过反复练习,孩子们可以逐渐掌握并熟练运用这些英语语法知识。
5. dishes(单数)- dish 6. put(现在分词)- putting 7. open(反义词)- close 8. give(过去式)- gave 9. first(原形)- first(保持不变) 10. tomato(复数)- tomatoes 11. people(复数)- people(保持...
dish -> dishes bus -> buses man -> men woman -> women 接着,我们进入一般现在时的学习。一般现在时主要用来描述事物的特征、状态,表示经常性或习惯性的动作,以及表达客观事实。 构成上,一般现在时有以下两...
2. Tom is helping his mom wash the dishes in the kitchen. - 汤姆正在厨房帮妈妈洗碗。 3. Lucy is watering the plants, making sure they grow healthy. - 露西正在给植物浇水,确保它们健康生长。 4. Ben is ...
4. sit down - 坐下 5. be late - 迟到 6. play computer games - 玩电脑游戏 7. get up - 起床 8. go to school - 上学 9. go to bed - 睡觉 10. make the bed - 整理床铺 11. sweep the floor - 扫地 12. do the ...
dish: dish -> dishes bus: bus -> buses man: man -> men woman: woman -> women **一般现在时**是英语中最基本的时态之一,它用来表达: 1. **经常性或习惯性的动作**,如"I get up at six every day."(我每天...
MySQL是一个关系型数据库管理系统,被广泛用于在线应用,因其高性能、稳定性及开源特性而备受青睐。在这个外卖点餐系统中,MySQL用于存储用户信息、菜品数据、订单记录等关键信息。 2.1 数据库设计 - 用户表(users...
6. 对于他人对食物的赞美,答句B "I’m glad you like the dishes" 表达了主人的欣慰和欢迎再次光临的意思。 7. 在求职场景中,职员确认信息并询问应聘者兴趣,选项B "Yes, we are." 表明职位确实在招聘中。 8. 这...
1. 写出动词的现在分词形式:go -> going, ride -> riding, draw -> drawing, play -> playing, sit -> sitting, collect -> collecting, swim -> swimming, sweep -> sweeping, run -> running, have -> having, ...
- 一连串过去动作(如:She cooked dinner, washed the dishes, and then watched TV.) - 时间或条件状语从句中的过去将来(如:If it rained, we would stay at home.) - 构成:主语+动词过去式 3. 一般将来...
5. I am doing the dishes. —— 此句正确。 6. My mother is answer the phone. —— 应改为:My mother is answering the phone. 这份练习题旨在通过不同的题型,帮助学生全面理解和掌握现在进行时的用法,包括...
1. 学习并掌握与家务相关的词汇,如:do the dishes(洗碗)、make the bed(铺床)、take out the rubbish(倒垃圾)、fold the clothes(叠衣服)、sweep the floor(扫地)和clean the living room(打扫客厅)等...
4. **Can you do the dishes?** 这个句子询问对方是否能帮忙洗碗。"do the dishes"是固定搭配,表示洗餐具。类似的结构还有"do some + 动词-ing",如"do some cooking"(做饭)。 5. **Could I at least finish ...