<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'C++ Builder 6 Darabase Search help' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'C++ Builder 6 Darabase Search help' posted on the 'C++ Builder' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2009 Programmers Heaven</copyright>
    <pubDate>Fri, 20 Nov 2009 20:52:07 -0700</pubDate>
    <lastBuildDate>Fri, 20 Nov 2009 20:52:07 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>C++ Builder 6 Darabase Search help</title>
      <link>http://www.programmersheaven.com/mb/bcbuilder/389425/389425/c++-builder-6-darabase-search-help/</link>
      <description>Hello!&lt;br /&gt;
I have a question about how to search a simple database. I have a Table ,a DataSource ,a DBGrid ,a button(for search) and an EditBox. I connected everything with my previously created Paradox7 database and everything shows nicely on the DBGrid. My question is , how can i search the database with the word or vale entered trough the edit box?&lt;br /&gt;
&lt;br /&gt;
I tried this but it`s not working. I got it to work but with only one field input " Table1-&amp;gt;Locate("Customer")... " , when i enter more fields to search in it`s not working... &lt;br /&gt;
&lt;br /&gt;
void __fastcall TForm3::Button1Click(TObject *Sender)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
TLocateOptions Opts;&lt;br /&gt;
Opts.Clear();&lt;br /&gt;
Opts &amp;lt;&amp;lt; loCaseInsensitive;&lt;br /&gt;
&lt;br /&gt;
Variant input[4];&lt;br /&gt;
&lt;br /&gt;
input[0]=Edit1-&amp;gt;Text;&lt;br /&gt;
input[1]=Edit1-&amp;gt;Text;&lt;br /&gt;
input[2]=Edit1-&amp;gt;Text;&lt;br /&gt;
input[3]=Edit1-&amp;gt;Text;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
bool control = Table1-&amp;gt;Locate("Customer;ID;Phone",VarArrayOf(input,4) ,Opts);&lt;br /&gt;
if(control==0) ShowMessage("The search has failed!"); &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
//---------------------------------------------------------------------------&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/bcbuilder/389425/389425/c++-builder-6-darabase-search-help/</guid>
      <pubDate>Sat, 18 Apr 2009 11:40:17 -0700</pubDate>
      <category>C++ Builder</category>
    </item>
    <item>
      <title>Re: C++ Builder 6 Darabase Search help</title>
      <link>http://www.programmersheaven.com/mb/bcbuilder/389425/389889/re-c++-builder-6-darabase-search-help/#389889</link>
      <description>I am sure there is a shorter way to do this but here take a look and dont mind the money part it was used to add the value of the items i searched that were found.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt; 
void __fastcall TForm6::FormShow(TObject *Sender)
{
int i = 1;
int p = 0;
int money =0;
Edit3-&amp;gt;Text = Form1-&amp;gt;ExistingVehicleList-&amp;gt;Text; //This is what iam searching what ever is in that textbox
Table1-&amp;gt;First(); //starts at top of DAtabase
        do
        {       if(Table1-&amp;gt;Fields-&amp;gt;Fields[4]-&amp;gt;AsString == Edit3-&amp;gt;Text)//if the text(searched item) = the item in field 4 which is my list of items name
                {
                StringGrid1-&amp;gt;Rows[0]-&amp;gt;CommaText = "ProPM Item_Repaired Descreption Cost Date";
                StringGrid1-&amp;gt;RowCount = i +1;
//All this stuff inputs the info into the cells on the table from the database as long as field 4 is equeal to my search text
                StringGrid1-&amp;gt;Cells[1][i] = Table1-&amp;gt;Fields-&amp;gt;Fields[0]-&amp;gt;AsString;
                StringGrid1-&amp;gt;Cells[2][i] = Table1-&amp;gt;Fields-&amp;gt;Fields[1]-&amp;gt;AsString;
                StringGrid1-&amp;gt;Cells[3][i] = Table1-&amp;gt;Fields-&amp;gt;Fields[2]-&amp;gt;AsInteger;
                StringGrid1-&amp;gt;Cells[4][i] = Table1-&amp;gt;Fields-&amp;gt;Fields[3]-&amp;gt;AsString;
                 i=i+1;
                 money = money + Table1-&amp;gt;Fields-&amp;gt;Fields[2]-&amp;gt;AsInteger;
                 p = 1;
                 }
                 Table1-&amp;gt;Next(); //goes to the next database field
        } while(Table1-&amp;gt;Eof == false) ; //searches database till it the end of hte database
        if(p == 0)
           StringGrid1-&amp;gt;RowCount = 0;
           
        Edit1-&amp;gt;Text = StringGrid1-&amp;gt;RowCount - 1;
        Edit2-&amp;gt;Text = money;

DBNavigator-&amp;gt;BtnClick(nbInsert);

}
&lt;/pre&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/bcbuilder/389425/389889/re-c++-builder-6-darabase-search-help/#389889</guid>
      <pubDate>Sun, 26 Apr 2009 20:17:57 -0700</pubDate>
      <category>C++ Builder</category>
    </item>
  </channel>
</rss>