使用VB.NET的Asp.net在运行时将行添加到数据表中 [英] Asp.net with VB.NET adding rows into data table in run time

查看:61
本文介绍了使用VB.NET的Asp.net在运行时将行添加到数据表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨所有

i我试图在数据表中添加行但是在添加一行之后再单击保存另一行消失因为帖子回来了

我怎么能添加新的排在前面但有停留的行

thnx

这是我的代码:





hi all
i am trying to add rows into data table but after add one row then click save the other row disappear because the post back
how can i add new rows but with stay of row before it
thnx
this is my code:


Dim dcItemID = New DataColumn("ItemID", GetType(Int32))
            Dim dcUnit = New DataColumn("UnitID", GetType(Int32))
            Dim ItemPrice = New DataColumn("ItemPrice", GetType(Int32))
            Dim sellprice = New DataColumn("SellPrice", GetType(Int32))


            dt.Columns.Add(dcItemID)
            dt.Columns.Add(dcUnit)
            dt.Columns.Add(ItemPrice)
            dt.Columns.Add(sellprice)

            dt.Rows.Add(Convert.ToInt32(rcItemName.SelectedValue), Convert.ToInt32(rcUnitID.SelectedValue), tbItemPrice.Text, tbSellprice.Text)





我尝试了什么:



i尝试每一个在互联网上找到的东西plz帮助



What I have tried:

i tried every thing that found in internet plz help

推荐答案

在dt.Rows.Add()之前做一个DIM dRow = dt.NewRow()

设置字段在dRow中然后添加你的dRow。
Before dt.Rows.Add() do a DIM dRow = dt.NewRow()
set the fields in dRow and then Add your dRow.


这篇关于使用VB.NET的Asp.net在运行时将行添加到数据表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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