Reading from .DBF in DBaseIII

J

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();
}
 
G

Guest

Have u tried to query data manually, for example via ServerExplorer window?
Does it return data?

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
 
K

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.
 
J

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.
 
K

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.

Peter Bromberg said:
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 said:
Kevin Spencer schreef:

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.
 
G

Guest

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




Kevin Spencer said:
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 said:
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 said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top