|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Reading from .DBF in DBaseIIIThe 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(); } 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 Offhand, I would guess that your table has no rows WHERE synchroid = 12.
-- Show quoteHide quoteHTH, Kevin Spencer Microsoft MVP Professional Numbskull Show me your certification without works, and I'll show my certification *by* my works. "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(); > } 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. 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 -- Show quoteHide quoteCo-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. > Peter,
I think you nailed it! -- Show quoteHide quoteKevin 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. >> Those were the days, Kevin. FoxPro 2.6 lives on... :-)
-- Show quoteHide quoteCo-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com UnBlog: http://petesbloggerama.blogspot.com "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. > >> > > >
Other interesting topics
When, why and where should a struct be used?
BackGroundWorker Problem assigning event handler to object.event Checkbox items under a RadioButton XML Querying .....??? DateTime formatting DataGridView and Adding Entries HttpWebResponse and ServerProtocolViolation Restricting rows via rowfilter? Basic Databinding Question C# |
|||||||||||||||||||||||