Groups | Blog | Home
all groups > dotnet ado.net > march 2008 >

dotnet ado.net : Dynamically created data source for GridView


Kerry Moorman
3/20/2008 11:57:12 AM
John,

You might consider using a command object's ExecuteReader method to execute
the SQL statement and return the resultset in a datareader.

Then load the data from the datareader into a datatable using the
datatable's Load method, which accepts a datareader.

Finally, apply the datatable to the gridview's DataSource property.

Kerry Moorman


[quoted text, click to view]
John
3/20/2008 3:25:33 PM
Hi

I have a SQL string on the lines;

"SELECT a,b, c FROM MyTable WHERE MyTable.d = '" & Me.MyField.text & "'"

The value of Me.MyField is provided at runtime by user. I need to assign the
resultset of this SQL to an UltraGrid for view only i.e. no editing just
display. My questions are;

1. What is the fastest way to assign the result of SQL string to the
UltarGrid as speed is of essence on runtime?

2. If the value of Me.MyField.text is changed by user then what code can I
use to refresh the UltraGrid with the new resultset?

Thanks

Regards


John
3/20/2008 3:26:39 PM
Sorry I meant GridView not UltraGrid.

Thanks

[quoted text, click to view]

AddThis Social Bookmark Button