Click here to Skip to main content
15,868,006 members
Home / Discussions / C#
   

C#

 
QuestionHelp me ... IEnumerable/IEnumerator Pin
Nguyen Jay3-Jan-15 17:54
Nguyen Jay3-Jan-15 17:54 
AnswerRe: Help me ... IEnumerable/IEnumerator Pin
BillWoodruff3-Jan-15 19:47
professionalBillWoodruff3-Jan-15 19:47 
GeneralRe: Help me ... IEnumerable/IEnumerator Pin
Nguyen Jay3-Jan-15 20:06
Nguyen Jay3-Jan-15 20:06 
QuestionFEATURE_BROWSER_EMULATION for Class Addin Pin
Member 113215783-Jan-15 9:57
Member 113215783-Jan-15 9:57 
AnswerRe: FEATURE_BROWSER_EMULATION for Class Addin Pin
BillWoodruff3-Jan-15 11:55
professionalBillWoodruff3-Jan-15 11:55 
GeneralRe: FEATURE_BROWSER_EMULATION for Class Addin Pin
Member 113215783-Jan-15 15:13
Member 113215783-Jan-15 15:13 
GeneralRe: FEATURE_BROWSER_EMULATION for Class Addin Pin
BillWoodruff3-Jan-15 15:35
professionalBillWoodruff3-Jan-15 15:35 
QuestionSearch options Database Pin
rattlerrFx3-Jan-15 6:38
rattlerrFx3-Jan-15 6:38 
The current search i have implemented into my program is limited to specific tables in the database. How do i go about adding the capabilities of searching all the tables within a database? In addition i would like to offer filters using check boxes to narrow the search parameters.

A JOIN would allow the search across multiple tables but the following line of code limits the search because of the "TestDescription='"

C#
DataRow[] returnRows = DS.Tables[0].Select("TestDescription='" + search + "'");


I have provided my code below:

C#
private void BtnSearch_Click(object sender, RoutedEventArgs e)
        {
            string ConnectionString = "Data Source=RATTLERR;Initial Catalog=medical;Integrated Security=True;";
            

            SqlConnection conn = new SqlConnection(ConnectionString);
            SqlDataAdapter dAdapter = new SqlDataAdapter("Select * FROM test", conn);
            
            conn.Open();
          
            DataSet DS = new DataSet();
            string search = tbSearch.Text;
            int result = 0;

            if (tbSearch.Text.Length >= 1)
            {
                

                dAdapter.Fill(DS);
                DataRow[] returnRows = DS.Tables[0].Select("TestDescription='" + search + "'");
                result = returnRows.Length;

                if (result > 0)
                {
                    dgInfo.ItemsSource = returnRows.CopyToDataTable().DefaultView;

                }
                else
                {
                    System.Windows.MessageBox.Show("No Records Found");
                }
                conn.Close();
                }
            }


modified 3-Jan-15 14:06pm.

AnswerRe: Search options Database Pin
DamithSL3-Jan-15 14:55
professionalDamithSL3-Jan-15 14:55 
GeneralRe: Search options Database Pin
rattlerrFx3-Jan-15 15:15
rattlerrFx3-Jan-15 15:15 
QuestionProblem sending bulk mails with multiple attachments. Pin
Member 108281323-Jan-15 5:09
Member 108281323-Jan-15 5:09 
AnswerRe: Problem sending bulk mails with multiple attachments. Pin
Richard MacCutchan3-Jan-15 5:17
mveRichard MacCutchan3-Jan-15 5:17 
QuestionEmailing Image To Tumblr Pin
JBHowl3-Jan-15 1:12
JBHowl3-Jan-15 1:12 
AnswerRe: Emailing Image To Tumblr Pin
DamithSL3-Jan-15 1:31
professionalDamithSL3-Jan-15 1:31 
GeneralRe: Emailing Image To Tumblr Pin
JBHowl3-Jan-15 1:45
JBHowl3-Jan-15 1:45 
SuggestionRe: Emailing Image To Tumblr Pin
Richard MacCutchan3-Jan-15 1:54
mveRichard MacCutchan3-Jan-15 1:54 
AnswerRe: Emailing Image To Tumblr Pin
JBHowl3-Jan-15 3:56
JBHowl3-Jan-15 3:56 
GeneralRe: Emailing Image To Tumblr Pin
Richard MacCutchan3-Jan-15 5:15
mveRichard MacCutchan3-Jan-15 5:15 
GeneralRe: Emailing Image To Tumblr Pin
Dave Kreskowiak3-Jan-15 8:24
mveDave Kreskowiak3-Jan-15 8:24 
GeneralRe: Emailing Image To Tumblr Pin
JBHowl5-Jan-15 4:19
JBHowl5-Jan-15 4:19 
GeneralRe: Emailing Image To Tumblr Pin
Dave Kreskowiak5-Jan-15 4:41
mveDave Kreskowiak5-Jan-15 4:41 
GeneralRe: Emailing Image To Tumblr Pin
JBHowl6-Jan-15 3:43
JBHowl6-Jan-15 3:43 
AnswerRe: Emailing Image To Tumblr Pin
JBHowl10-Jan-15 2:48
JBHowl10-Jan-15 2:48 
QuestionTrouble handling DeviceIoControl to retrieve USN data Pin
Mandelnuss3-Jan-15 0:46
Mandelnuss3-Jan-15 0:46 
AnswerRe: Trouble handling DeviceIoControl to retrieve USN data Pin
Richard MacCutchan3-Jan-15 0:57
mveRichard MacCutchan3-Jan-15 0:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.