Wpf - select data from the MS access database provided

I am accessing a table from my access database in my wpf application. But the problem is that there are spaces in the beginning in my column with id. For instance. My table contains an evaluation identifier column that contains various identifiers, such as 141A, 14B, 13521B. but there are spaces at the beginning of these identifiers. (141A, 14A, 14152B), so when I pass the parameter from the request in my wpf application, it returns an empty table. my code

string query1 = "select * from Estimates where EstimateNo = '141A'";
DataTable dt = new DataTable();
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = new OleDbCommand(query1, myDataConnection);
da.Fill(dt);

is there any method where i can specify the condition in the where clause. i) may contain any number of white spaces at startup, but should end, what does the code mean?

What will we do?

+3
source share
2

, , LTRIM

string query1 = "select * from Estimates where LTRIM(EstimateNo) = '141A'";
DataTable dt = new DataTable();
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = new OleDbCommand(query1, myDataConnection);
da.Fill(dt);
+2

LTRIM sql-   , ,

LTRIM(RTRIM(ColumnName))
+1

All Articles