Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
General idea is to add ASCII data from text file to existing data in DataSet, first string of txt file is the same as DataSet column, but not in the same order.

I try to search one colum for specific string and add data to it. I get error message "cannot interpret token ""......"

I tryed to search rows using DataSet.Tables[].Select()

search string is "column = 'searchstring'"
brtoc is column in DataSet, ucitavanje_brtoc is the same string from ASCII file.

string a = "\"brtoc" + " " + "=" + " " + "'" + ucitavanje_brtoc + "'" + "\"";
MessageBox.Show(a); //just to see if output string is ok

DataRow addbazaRow = gui1DataSet.Tables["baza"].Select(a).FirstOrDefault();

// code to add data to existing row

What am i doing wrong?


Thank You

note: this is my first project in VS, and i'm a noob :)
sorry for my bad english
Posted
Updated 14-Oct-13 14:11pm
v2

1 solution

Try removing the escaped quotes around your search string. Try using this when you build your search string...
C#
string a = "brtoc" + " " + "=" + " " + "'" + ucitavanje_brtoc + "'";

Also, here's the same thing but with simplified concatenation...
C#
string a = "brtoc = '" + ucitavanje_brtoc + "'";
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900