Trim Column value access Interbase
-
Hi, I have a project which is used the interbase database. Issue is, one column with datatype char(100) in a table. I will bind this column in grid when empty space also binded. I have used to ltrim(rtrim(Name)) function in SQL statment. It wouldnt affect. How can i trim this empty space? Thanks in advance.
-
Hi, I have a project which is used the interbase database. Issue is, one column with datatype char(100) in a table. I will bind this column in grid when empty space also binded. I have used to ltrim(rtrim(Name)) function in SQL statment. It wouldnt affect. How can i trim this empty space? Thanks in advance.
Strange the SQL TRIM would not work How ever , I will give you another solution , with code :
MyDataTable = New DataTable ();
SqlConnect con = new SqlConnection ("connection string goes here ") ;
SqlDataAdapter SqlDa = new SqlDataAdapter ("SELECT * FROM myTable", conn);
SqlDa.Fill(myDataTable);foreach ( DataRow dr in MyDataTable.Rows)
{
dr["ColumnName"] = dr["ColumnName"].toString().Trim();
}Hope This Help , ------------ :rose: Please Increase the hit's of my website by 1 ::rose: ----------- www.smart-arab.com
I know nothing , I know nothing ...
-
Strange the SQL TRIM would not work How ever , I will give you another solution , with code :
MyDataTable = New DataTable ();
SqlConnect con = new SqlConnection ("connection string goes here ") ;
SqlDataAdapter SqlDa = new SqlDataAdapter ("SELECT * FROM myTable", conn);
SqlDa.Fill(myDataTable);foreach ( DataRow dr in MyDataTable.Rows)
{
dr["ColumnName"] = dr["ColumnName"].toString().Trim();
}Hope This Help , ------------ :rose: Please Increase the hit's of my website by 1 ::rose: ----------- www.smart-arab.com
I know nothing , I know nothing ...
-
Thank you Stark DaFixzer. I did try this code. But I have 10 million rows. So it will take more time to bind. Please any other solutions. Thanks in Advance Rameshkumar
I Think that there is a hidden Character at the end of your string that you try trim try to copy the value and paste it , in a word application , OR notepad++ , then press ( Show All Character Button ) it's looks like ( ¶ ) ---- IF you found a hidden chars , which is not a space , then you can remove this char by updating all your records , and re-use the LTRIM (RTRIM) Function again Hope this help , Kind regards
I know nothing , I know nothing ...
-
I Think that there is a hidden Character at the end of your string that you try trim try to copy the value and paste it , in a word application , OR notepad++ , then press ( Show All Character Button ) it's looks like ( ¶ ) ---- IF you found a hidden chars , which is not a space , then you can remove this char by updating all your records , and re-use the LTRIM (RTRIM) Function again Hope this help , Kind regards
I know nothing , I know nothing ...
-
Hi Stark DaFixzer, I checked that table. There is no empty space and special characters. Please any other way to trim the values. Thanks in Advance Rameshkumar.T
Hi Stark DaFixzer, I got a solution for trim the values using LINQ. The following statementi have used in my application.
var NameList = (from param_enum_desc in dsPartnertype.Tables[0].AsEnumerable()
select new
{
POS_VALUE = param_enum_desc.Field<string>("POS_VALUE"),
POS_DESCR = param_enum_desc.Field<string>("POS_DESCR")
});stoPartner.DataSource = NameList; stoPartner.DataBind();
Thank you Rameshkumar.T
-
Hi Stark DaFixzer, I got a solution for trim the values using LINQ. The following statementi have used in my application.
var NameList = (from param_enum_desc in dsPartnertype.Tables[0].AsEnumerable()
select new
{
POS_VALUE = param_enum_desc.Field<string>("POS_VALUE"),
POS_DESCR = param_enum_desc.Field<string>("POS_DESCR")
});stoPartner.DataSource = NameList; stoPartner.DataBind();
Thank you Rameshkumar.T
Hi Stark DaFixzer, sorry i forgot trim method to end of the statement.
var NameList = (from param_enum_desc in dsPartnertype.Tables[0].AsEnumerable()
select new
{
POS_VALUE = param_enum_desc.Field<string>("POS_VALUE").Trim(),
POS_DESCR = param_enum_desc.Field<string>("POS_DESCR").Trim()
});stoPartner.DataSource = NameList; stoPartner.DataBind();
Thank you Rameshkumar.T