电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

连锁中心配送系统:产品模块的管理[3]


发布日期:2023/5/8
 
——此文章摘自《ASPNET +SQL Server网络应用系统开发案例精解》定价特价 详细>>http://tracklinktechcn/?m_id=dangdang&a_id=A&l=&l_type= width= height= border= nosave>

STmyGridEditItemIndex=;

BindGrid();

}

)响应删除事件

//单击删除按钮所触发的事件

public void STmyGrid_delete(object source SystemWebUIWebControlsDataGridCommandEventArgs e)

{

//创建删除指定ID的sql语句

string STstrsql = delete from STProd where STProdID = @STProdID;

//创建SqlCommand对象对sql语句进行操作

SqlCommand STcmd = new SqlCommand(STstrsqlSTconn);

//向SqlCommand对象添加参数

STcmdParametersAdd(new SqlParameter(@STProdIDSqlDbTypeInt));

//向参数赋值

STcmdParameters[@STProdID]Value = STmyGridDataKeys[(int)eItemItemIndex];

STcmdConnectionOpen();

try

{

//执行sql语句

STcmdExecuteNonQuery();

}

catch(SqlException)

{

}

STcmdConnectionClose();

ResponseRedirect(STManagerProductaspx);

}

.产品信息的添加

单击左边链接的添加产品信息即可进入产品添加界面STManagerAddProductaspx如图所示

http://developcsaicn/dotnet_ASP/images/jpg>

产品添加界面

文本框用来输入产品名称按钮用来提交和重填标签用来提示添加是否成功在STManagerAddProductaspxcs文件中首先打开一个数据库连接然后在添加按钮处理中再将用户填写的产品名称插入到数据库中

private void Page_Load(object sender SystemEventArgs e)

{

if(Session[STNickName] != null)

{

//获得数据库连接字符串

string STconnection = ConfigurationSettingsAppSettings[strconnection];

right>[http://developcsaicn/dotnet_ASP/htm>] [http://developcsaicn/dotnet_ASP/htm>] [] [http://developcsaicn/dotnet_ASP/htm>]

上一篇:连锁中心配送系统:产品模块的管理[2]

下一篇:连锁中心配送系统:产品模块的管理[1]