Home All Groups Group Topic Archive Search About

Reading from .DBF in DBaseIII

Author
13 Apr 2006 6:36 AM
Jo Segers
Hi,

The code SQLstatement below does not return any rows, but if I remove
the WHERE-clause I get the full table as the result.

private OleDbConnection GetDBaseIIIConnection()
{
    string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\;Extended Properties=dBASE III";
    return new OleDbConnection(connectionString);
}

private void button2_Click(object sender, System.EventArgs e)
{
    dataSet.Clear();
    string query = "SELECT * FROM [imsyncro.it] WHERE synchroid = 12";
    OleDbCommand oComm =  new OleDbCommand(query, GetDBaseIIIConnection());

    oComm.Connection.Open();
    OleDbDataAdapter a = new OleDbDataAdapter(oComm);
    a.Fill(dataSet, "imsyncro");
    listBox.Items.Add(dataSet.Tables["imsyncro"].Rows.Count);

    oComm.Connection.Close();
}

Author
13 Apr 2006 8:03 AM
Michael Nemtsev
Have u tried to query data manually, for example via ServerExplorer window?
Does it return data?


Show quoteHide quote
> The code SQLstatement below does not return any rows, but if I remove
> the WHERE-clause I get the full table as the result.
>
> private OleDbConnection GetDBaseIIIConnection()
> {
>     string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=c:\;Extended Properties=dBASE III";
>     return new OleDbConnection(connectionString);
> }
>
> private void button2_Click(object sender, System.EventArgs e)
> {
>     dataSet.Clear();
>     string query = "SELECT * FROM [imsyncro.it] WHERE synchroid = 12";
>     OleDbCommand oComm =  new OleDbCommand(query, GetDBaseIIIConnection());
>
>     oComm.Connection.Open();
>     OleDbDataAdapter a = new OleDbDataAdapter(oComm);
>     a.Fill(dataSet, "imsyncro");
>     listBox.Items.Add(dataSet.Tables["imsyncro"].Rows.Count);
>
>     oComm.Connection.Close();
> }

--
WBR,
Michael  Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Are all your drivers up to date? click for free checkup

Author
13 Apr 2006 10:35 AM
Kevin Spencer
Offhand, I would guess that your table has no rows WHERE synchroid = 12.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

Show quoteHide quote
"Jo Segers" <jo.seg***@alro.be> wrote in message
news:u0ijTSsXGHA.3448@TK2MSFTNGP04.phx.gbl...
> Hi,
>
> The code SQLstatement below does not return any rows, but if I remove the
> WHERE-clause I get the full table as the result.
>
> private OleDbConnection GetDBaseIIIConnection()
> {
> string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=c:\;Extended Properties=dBASE III";
> return new OleDbConnection(connectionString);
> }
>
> private void button2_Click(object sender, System.EventArgs e)
> {
> dataSet.Clear();
> string query = "SELECT * FROM [imsyncro.it] WHERE synchroid = 12";
> OleDbCommand oComm =  new OleDbCommand(query, GetDBaseIIIConnection());
>
> oComm.Connection.Open();
> OleDbDataAdapter a = new OleDbDataAdapter(oComm);
> a.Fill(dataSet, "imsyncro");
> listBox.Items.Add(dataSet.Tables["imsyncro"].Rows.Count);
>
> oComm.Connection.Close();
> }
Author
13 Apr 2006 12:10 PM
Jo Segers
Kevin Spencer schreef:
> Offhand, I would guess that your table has no rows WHERE synchroid = 12.
>

Hi Kevin,

There if a row where syncroid = 12 I checked this manually in the dbf.
The query also doesn't work when I specify WHERE synchroid < 1000; none
of the where clauses work.

Best regards,

Jo.
Author
13 Apr 2006 12:54 PM
Peter Bromberg [C# MVP]
Jo,
it may be possible that this is coming into the DataSet as a string.

So try this:

"SELECT * FROM [imsyncro.it] WHERE synchroid = '12'";


Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




Show quoteHide quote
"Jo Segers" wrote:

> Kevin Spencer schreef:
> > Offhand, I would guess that your table has no rows WHERE synchroid = 12.
> >
>
> Hi Kevin,
>
> There if a row where syncroid = 12 I checked this manually in the dbf.
> The query also doesn't work when I specify WHERE synchroid < 1000; none
> of the where clauses work.
>
> Best regards,
>
> Jo.
>
Author
13 Apr 2006 3:15 PM
Kevin Spencer
Peter,

I think you nailed it!

--

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

Show quoteHide quote
"Peter Bromberg [C# MVP]" <pbromberg@yahoo.nospammin.com> wrote in message
news:CE69E51D-97B4-4EC1-B0E0-5295581195E6@microsoft.com...
> Jo,
> it may be possible that this is coming into the DataSet as a string.
>
> So try this:
>
> "SELECT * FROM [imsyncro.it] WHERE synchroid = '12'";
>
>
> Peter
> --
> Co-founder, Eggheadcafe.com developer portal:
> http://www.eggheadcafe.com
> UnBlog:
> http://petesbloggerama.blogspot.com
>
>
>
>
> "Jo Segers" wrote:
>
>> Kevin Spencer schreef:
>> > Offhand, I would guess that your table has no rows WHERE synchroid =
>> > 12.
>> >
>>
>> Hi Kevin,
>>
>> There if a row where syncroid = 12 I checked this manually in the dbf.
>> The query also doesn't work when I specify WHERE synchroid < 1000; none
>> of the where clauses work.
>>
>> Best regards,
>>
>> Jo.
>>
Author
13 Apr 2006 11:39 PM
Peter Bromberg [C# MVP]
Those were the days, Kevin. FoxPro 2.6 lives on... :-)
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




Show quoteHide quote
"Kevin Spencer" wrote:

> Peter,
>
> I think you nailed it!
>
> --
>
> Kevin Spencer
> Microsoft MVP
> Professional Numbskull
>
> Show me your certification without works,
> and I'll show my certification
> *by* my works.
>
> "Peter Bromberg [C# MVP]" <pbromberg@yahoo.nospammin.com> wrote in message
> news:CE69E51D-97B4-4EC1-B0E0-5295581195E6@microsoft.com...
> > Jo,
> > it may be possible that this is coming into the DataSet as a string.
> >
> > So try this:
> >
> > "SELECT * FROM [imsyncro.it] WHERE synchroid = '12'";
> >
> >
> > Peter
> > --
> > Co-founder, Eggheadcafe.com developer portal:
> > http://www.eggheadcafe.com
> > UnBlog:
> > http://petesbloggerama.blogspot.com
> >
> >
> >
> >
> > "Jo Segers" wrote:
> >
> >> Kevin Spencer schreef:
> >> > Offhand, I would guess that your table has no rows WHERE synchroid =
> >> > 12.
> >> >
> >>
> >> Hi Kevin,
> >>
> >> There if a row where syncroid = 12 I checked this manually in the dbf.
> >> The query also doesn't work when I specify WHERE synchroid < 1000; none
> >> of the where clauses work.
> >>
> >> Best regards,
> >>
> >> Jo.
> >>
>
>
>

Bookmark and Share