Click here to Skip to main content
15,912,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have table bill entry, column is ppo_no that is type is nvarchar(35)

suppose in database column value is 07963 (it 5 character)

when i retrieve this value in text box , value retrieved with rest 22 white space
but i want to retrieve only entered value
please solve this query
Posted

*Assuming your database is MS SQL Sevrer*
Have a look at the LTRIM and RTRIM SQL functions.

Then you could do something like this to remove the whitespace:

SQL
SELECT
    LTRIM(RTRIM(ppo_no)) AS ppo_no
FROM
    [bill entry]


*Assuming it's Oracle*
Have a look at the TRIM SQL function.

*Since you stated its VB.NET*

Something like:
VB
txtTextBox.Text = DataTable.Rows(iRowNumber).ItemArray(iColumnNumber).ToString().Trim()

or
VB
txtTextBox.Text = DataTable.Rows(0)("ppo_no").ToString().Trim()


Hope it helps.
 
Share this answer
 
v3
Comments
tanugarg 17-Jun-14 6:30am    
please give in vb.net
hypermellow 17-Jun-14 9:22am    
In VB, it would be something like this:
txtTextbox.Text = DataTable.Rows(iRowNumber).ItemArray(iColumnNumber).ToString().Trim()

The .Trim() call at the end will remove the whitespace characters.

Hope it helps.
when you assign the values to the textbox
just use the trim[^] function in vb.net
 
Share this answer
 
you can do it from sql and code behind from both.
if you want it from back end then try solution 1 and you want it from code behind then use Trim() function of vb.net before assigning value to text box.

VB.NET Trim[^]

Trim, LTrim, and RTrim Functions[^]

VBScript Trim Function[^]
 
Share this answer
 

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