如何使用游标和存储过程访问数据网格值 [英] how to acess data grid values using cursor and stored procedures

查看:118
本文介绍了如何使用游标和存储过程访问数据网格值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们请帮帮我.

在我的项目中,我创建了一个网页区域详细信息,我使用了一个数据网格以及添加到网格中的多个国家/地区名称和代码.在将数据插入表中之后,我必须将总网格值(如表)发送到数据库,所以我不知道任何想法,请给出您的宝贵建议
在此先感谢

hi friends please help me.

in my project i created one webpage territory details, i use one data grid and multiple of countries names and codes added to the grid. i have to send total grid values(like a table)to database after that i insert the data in a table,so i don''t have any idea please give your valuable suggestions
thanks in advance

推荐答案

如果您已经使用DataSet完成了网格,这是一个简单的任务..

创建一个类型化的数据集(您可以使用自动生成的代码进行所有db交互,否则您必须编写自己的动态sql/存储过程并将其附加.

如果假设您在click事件中的页面中有一个保存"按钮,则可以遍历网格并将其填充到数据集中,然后在db中进行更新.

//类型化的数据集
TerritoryDataSet ds = new TerritoryDataSe();

foreach(grid.Rows中的GridViewRow grdRow)
{
TerritoryDataSet.TerritoryRow terrRow = ds.Torritory.NewTerritoryRow();
terrRow.Column1 row.Cells [0];
..............
ds.Territory.AddTerritoryRow(terrRow);
}

//
更新数据集.

我认为这有帮助...
还是请解释一下您在哪里挣扎?
if you have done the grid using the DataSet it''s an easy task..

Create a typed dataset (you can have all the db interaction using the autogenerated code, or else you have to write your own dynamic sql/stored procedure and attach it.

if suppose you have a Save button in the page in the click event you can iterate through the grid and fill it in the dataset and then update in the db.

//typed dataset
TerritoryDataSet ds = new TerritoryDataSe();

foreach(GridViewRow grdRow in grid.Rows)
{
TerritoryDataSet.TerritoryRow terrRow= ds.Torritory.NewTerritoryRow();
terrRow.Column1 row.Cells[0];
..............
ds.Territory.AddTerritoryRow(terrRow);
}

//
update the dataset.

I think this helps...
or please explain where you are struggling?


好,您可以将参数作为LOB数据类型或varchar(如果长度很小)并发送给过程.
ODP.NET具有oracleParamter,您可以键入.

在oracle程序中,您必须解析XML.我建议使用强类型分析器.如果需要,我会在几个小时后尝试发布一些代码...
ok you can have the parameter as LOB datatype or varchar (if it has small length) and sent to procedures..

ODP.NET has oracleParamter and type you can do it.

in oracle precedure you have to parse the XML. I would suggest to use strongly typed parser. I will try to post few codes after few hours if required...


这篇关于如何使用游标和存储过程访问数据网格值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆