Robert McLaws: FunWithCoding.NET

Public Shared Function BrainDump(ByVal dotNet As String) As [Value]

News

<script type="text/javascript"><!-- google_ad_client = "pub-4330602465258980"; google_hints = "ASP.NET, VB.NET, C#, C#.NET, WindowsForms, .NET Framework, VS2005, Visual Studio, XAML, WinFX, Windows Workflow, WPF, WCF, Atlas, NetFX3, Visual Studio Orcas"; google_ad_width = 120; google_ad_height = 240; google_ad_format = "120x240_as"; google_ad_type = "text_image"; google_ad_channel ="4997399242"; google_color_border = "B6C9E7"; google_color_bg = "EFEFEF"; google_color_link = "0000FF"; google_color_text = "000000"; google_color_url = "002C99"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<!--
-->

You should feel free to challenge me, disagree with me, or tell me I'm completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever. That said, I will most likely only delete abusive, profane, rude, or annonymous comments, so keep it polite, please.

Blogroll

Cool .NET Articles

My .NET Tools

My Builder.com Articles

My MSKB Articles

Wouldn't it be great....

If there was a way to use TSQL syntax to query against a loaded DataSet? Something like:

Dim Settings As New DataSet
Settings.ReadXml("..\settings.xml", XmlReadMode.InferSchema)
Dim result As New DataTable = Settings.Query("SELECT * FROM Tables(0) WHERE Row.Item('Default') = FALSE")
SomeDataGrid.DataSource = result
SomeDataGrid.DataBind

Man, I think that would be neat. Anybody know if you can do this today?

Comments

Scott Glasgow said:

Not really what you're looking for, but the closest you can get to that, that I know of is using the Select method on the DataTable object. It returns an array of DataRow objects though.
# March 15, 2004 3:35 PM

TJ said:

You can get the same result by using a dataview, or like th eprevious poster said by using select on the Datatable.

You can do it its just not as stright foward.

DataRow[] foundRows =
Sessings.Tables[0].Select( "Default='FALSE'", "", DataViewRowState.Modified );
# March 15, 2004 4:12 PM

Scott said:

I've used the RowFilter to that kind of effect.

PtDs = getTodaysPatients();
DateTime dteSelDate = (DateTime)ViewState["FetchDate"];
if(PtDs.Tables.Count > 0)
{
DataView PtDv = PtDs.DefaultViewManager.CreateDataView(PtDs.Tables[0]);
PtDv.Sort = ViewState["ClinSortColumn"].ToString() + " " + ViewState["ClinSortOrder"].ToString();
PtDv.RowFilter = (string)ViewState["ClinFilterValue"];
dgTodaysPts.EditItemIndex = int.Parse(ViewState["EditItemIndex"].ToString());
dgTodaysPts.DataSource = PtDv;
dgTodaysPts.DataBind();
}
# March 15, 2004 7:10 PM

Scott said:

whoops, where (string)ViewState["ClinFilterValue"] equals a where clause. "clinic='MO' AND physicianId=3214"
# March 15, 2004 7:11 PM

Todd Moon said:

Yes, I was dreaming of the same thing just yesterday. I wanted to do a simple inner join between two tables in my DataSet. I resorted to sinking ItemDataBound and dynamically changing the Text property of the Cell after manually looking up the value I needed from the related table. Not exaclty elegant, but it worked.
# March 16, 2004 10:15 AM