Hi,
I am not sure why you are getting the error. However I would stop
using late binding it might help find your error.
Dim dataTables as dataset = Accessor.Draw(inString)
Ken
-----------------
"Jumping Matt Flash" <ju**************@gmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Many thanks Ken,
However i've continued to have issues with your code for some reason. As i'm
retrieving only the one row i've tried using the following: Draw is a web
service which returns a dataset according to inString
Dim dataTables = Accessor.Draw(inString)
Dim dt2 As New DataTable("Translated")
dataTables.Tables.Add(dt2)
'Loop table(0) translating the data
Dim dr As DataRow = dataTables.Tables(1).NewRow
For y As Integer = 0 To dataTables.Tables(0).Columns.Count - 1
dr(y) = dataTables.Tables(0).Rows(0).Item(y)
Next
dataTables.Tables(1).Rows.Add(dr)
This just returns the following error however:
Exception Details: System.IndexOutOfRangeException: Cannot find column 0.
Source Error:
Line 34: Dim dr As DataRow = dataTables.Tables(1).NewRow
Line 35: For y As Integer = 0 To
dataTables.Tables(0).Columns.Count - 1
Line 36: dr(y) = dataTables.Tables(0).Rows(0).Item(y)
Line 37: Next
Line 38: dataTables.Tables(1).Rows.Add(dr)
TIA
Matt
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uH****************@TK2MSFTNGP12.phx.gbl...
Hi,
http://www.windowsformsdatagridhelp....8-2b9e762316ab
Ken
------------------
"Jumping Matt Flash" <ju**************@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
The code i'm writing is using VB .NET and is for a web service returning a
dataset, which is in turn to be used by an ASP .NET application displaying
a
datagrid.
I'm currently populating a datagrid using a "select top 1 column 1,
column2,
column3 from tblTable" statement. As there will only ever be one row
returned I want to be able to to switch the column names to be row1 and
the
column values to be row 2
i.e. select house, street, state from table addresses
16, Washington Way, NYC
to be displayed as
ELEM VAL
------- -------
House 16
Street Washington Way
State NYC
To make this translation easiest i want to be able to do this using my web
service. Any ideas as to how i can manipulate my dataset in such a way?
TIA,
Matt