Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > OleDB
 

OleDB

I'm linking a CSV file to an obseravable collection (or at least trying to). My column name is Ticket ID in my CSV file. I'm linking and trying to get data using:

 

string commandString = "SELECT * FROM " + System.IO.Path.GetFileName(m_history) +@" where ""Ticket ID"" = " + _td.TicketID + " ";

when I change it to string commandString = "SELECT * FROM " + System.IO.Path.GetFileName(m_history) it workes without any problems as far as loading, so it is the selection.

What can I look at to troubleshoot?

Thanks

a2BWell  Wednesday, October 07, 2009 4:01 PM
I ended up deleting all of it and re-doing it as just a CSV file. Once I did that, I got the error on Ticket ID, so in the file I changed it to Ticket_ID and changed the program to reflect that and everything is working great. Thanks.
  • Marked As Answer bya2BWell 17 hours 53 minutes ago
  •  
a2BWell  17 hours 54 minutes ago
I don't think the field name needs quotes around it and I thought that the parameter value needed single quotes. Something like this:

@" where Ticket ID = '" + _td.TicketID + '";

Hope this helps.

www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Wednesday, October 07, 2009 6:10 PM
if I do that, I get this error:

System.Data.OleDb.OleDbException: Syntax error (missing operator) in query expression 'Ticket ID = '1002833''

a2BWell  Wednesday, October 07, 2009 6:23 PM
I ended up deleting all of it and re-doing it as just a CSV file. Once I did that, I got the error on Ticket ID, so in the file I changed it to Ticket_ID and changed the program to reflect that and everything is working great. Thanks.
  • Marked As Answer bya2BWell 17 hours 53 minutes ago
  •  
a2BWell  17 hours 54 minutes ago
Check out if there is a cloumn named Ticket ID - I assumes causes the  there is no blank in this column but an underscore. This might cuase the:

 Syntax error (missing operator) in query expression 'Ticket ID = '1002833''
Christoph Wagner  17 hours 52 minutes ago

You can use google to search for other answers

Custom Search

More Threads

• DataGridView.CancelEdit() doesn’t.
• DataGridView Virtual Mode Performance
• in vb.net programming i have a requriment of a control like the message we type while posting a thread in forums
• Dbl click btw rows in grid?
• DataGrid printing tiny data
• datagridview and combobox bound to datatable
• Please help with this VB,NET problem
• Order of events when updating BindingSource.
• datagrid view
• Printing Multiple Pages