multirow的添加数据的问题
刚刚接触multirow,使用vs软件,multirow版本是最新的,之前看到网上的答案很多都不能用了。我手动建了datatable,里边有十多条数据,想把它插入到multirow中,但是插入的时候只能插进去一条。我想让它一查询全都显示出来。请问一下该怎么写。挺急的
下边是具体的代码,太多了挑出几行来,帮忙看看我该怎么写,是不是哪里错了
Dim DTForNow As New DataTable
With DTForNow
.Columns.Add("SHOHIN_CD", GetType(Int32))
.Columns.Add("SHOHIN_NM", GetType(String))
.Columns.Add("ZEI_KBN", GetType(String))
.Columns.Add("GENKA_ZEIKOMI", GetType(Double))
.Columns.Add("GENKA_ZEINUKI", GetType(Double))
.Columns.Add("BAIKA", GetType(Double))
End With
Dim row As DataRow = DTForNow.NewRow
If txtShoBunruiCD.Text = "100" Then
row = DTForNow.NewRow
row("SHOHIN_CD") = 100
row("SHOHIN_NM") = "sikeda"
row("ZEI_KBN") = "1:税込み"
row("GENKA_ZEIKOMI") = 108000.0
row("GENKA_ZEINUKI") = 100000.0
row("BAIKA") = 110000
DTForNow.Rows.Add(row)
End If
If txtShoBunruiCD.Text = "200" Then
row = DTForNow.NewRow
row("SHOHIN_CD") = 200
row("SHOHIN_NM") = "aodi"
row("ZEI_KBN") = "2:税抜き"
row("GENKA_ZEIKOMI") = 216000.0
row("GENKA_ZEINUKI") = 200000.0
row("BAIKA") = 210000
DTForNow.Rows.Add(row)
End If
'bang 定
Dim ds As DataSet = New DataSet()
mgrdMeisaiList.DataSource = DTForNow
mgrdMeisaiList.DataSource.Rows.Add(DTForNow.NewRow)
如果只是需要显示table数据的话,下面的代码可以参考
Dim gcMultiRow = New GcMultiRow()
Me.Controls.Add(gcMultiRow)
Dim template__1 = Template.CreateGridTemplate(2)
template__1.Row.Cells(0).DataField = "Name"
template__1.Row.Cells(1).DataField = "Address"
Dim dataTable = New DataTable()
dataTable.Columns.Add(New DataColumn("Name", GetType(String)))
dataTable.Columns.Add(New DataColumn("Address", GetType(String)))
Dim row = dataTable.NewRow()
row("Name") = "Jack"
row("Address") = "Xian"
dataTable.Rows.Add(row)
row = dataTable.NewRow()
row("Name") = "Marry"
row("Address") = "England"
dataTable.Rows.Add(row)
gcMultiRow.Template = template__1
gcMultiRow.DataSource = dataTable OK,谢谢您。已经解决问题了。:lol 不客气
页:
[1]