For Programmers: Free Programming Magazines  


Home > Archive > C# > January 2005 > datagrid, dataadapters, and setdatabinding









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author datagrid, dataadapters, and setdatabinding
hillscottc

2005-01-07, 8:57 pm


I have two DataAdapters....1)daStandard does a SELECT *, and
2)daDuplicates uses a stored proc which returns only rows with some
duplicate data.

Problem is, when I butRefresh_Click and I have selected ALL, I am never
able to refresh the data to the DUPS subset of data.
Every click returns ALL records. If I choose DUPS the first time it
works once, but once I do ALL I can no longer get just the DUPS.


I think I am not clearly understanding the relationship betwen
DataAdapter, DataGrid, and SetBinding.

Any help?


protected void BindGrid(Resources.Operations op)
{

switch (op)
{
case Resources.Operations.DUPS :

daDuplicates.Fill(mP3Library1, "MainLibrary");
break;


case Resources.Operations.ALL :
default:

daStandard.Fill(mP3Library1, "MainLibrary");
break;

}


dataGrid1.SetDataBinding(mP3Library1, "MainLibrary");


}


private void butRefresh_Click(object sender, System.EventArgs e)
{


if (checkDups.Checked)
{
BindGrid(Resources.Operations.DUPS);
}
else
{
BindGrid(Resources.Operations.ALL);
}



}

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com