Click here to Skip to main content
16,011,988 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here i posted my code

i want dynamic creation of tablename. For example in while loop if i=1 then create dt1 as new datatable and i=2 create dt2 as new datatable and so on....

anybody can help me....

Dim ds1 As New DataSet
Dim ds2 As New DataSet
Dim ds3 As New DataSet
Dim ds4 As New DataSet

Dim i As Integer = 1
Dim startind As Integer
Dim endind As Integer
startind = 0
endind = 25
Dim totalcount As Double
totalcount = ds.Tables(0).Rows.Count
Dim currentcount As Double
currentcount = Math.Round(totalcount / 25)

Dim dtname As Integer = 1


If ds.Tables(0).Rows.Count > 25 Then

While (i <= currentcount)


Dim dt1 As New System.Data.DataTable
dt1 = splitrecords(ds.Tables(0),ds.Tables(0).Rows.Count, startind, endind)
ds1.Tables.Add(dt1)
End While
End If


ds2.Tables(0).TableName = "Table1"
ds3.Tables(0).TableName = "Table2"
ds4.Tables(0).TableName = "Table3"
ds1.Tables.Add(ds2.Tables(0).Copy)
ds1.Tables.Add(ds3.Tables(0).Copy)
ds1.Tables.Add(ds4.Tables(0).Copy)

ds2.Clear()
ds3.Clear()
ds4.Clear()
ds.Clear()
End If
Posted

I am not following the problem here. It seems to me that you can build the table name from the value of i, if i=1 is dt1, i=2 is dt2, etc ?
 
Share this answer
 
yes u r right...can u guide me with sample code
 
Share this answer
 
i have a problem Like
i am getting data from database like this format

id Name RollNO
1 amit 1111
2 Sumit 1012


i want my output in grid view
like


id 1 2
Name amit Sumit
RollNO 1111 1012
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900