在Sql我有表条例输入 [英] In Sql I Have Table Bill Entry
本文介绍了在Sql我有表条例输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有表条目条目,列是ppo_no,类型是nvarchar(35)
假设数据库列值为07963(它是5个字符)
当我在文本框中检索此值时,使用其余22个空格检索值
但我想仅检索输入的值
请解决此查询
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
推荐答案
*假设您的数据库是MS SQL Sevrer *
看看 LTRIM 和 RTRIM SQL函数。
那么你可以做这样的事情来删除空格:
*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:
SELECT
LTRIM(RTRIM(ppo_no)) AS ppo_no
FROM
[bill entry]
*假设它是Oracle *
查看 TRIM SQL函数。
*既然你声明了它的VB.NET *
类似的东西:
*Assuming it's Oracle*
Have a look at the TRIM SQL function.
*Since you stated its VB.NET*
Something like:
txtTextBox.Text = DataTable.Rows(iRowNumber).ItemArray(iColumnNumber).ToString().Trim()
或
or
txtTextBox.Text = DataTable.Rows(0)("ppo_no").ToString().Trim()
希望它有所帮助。
Hope it helps.
当你将值分配给文本框时
只需使用trim [ ^ ] vb.net中的函数
when you assign the values to the textbox
just use the trim[^] function in vb.net
你可以从sql和代码后面做到这一点来自两者。
如果你想要我从后端开始然后尝试解决方案1 然后从后面的代码中获取它然后在为文本赋值之前使用Trim()
vb.net的函数框。
VB.NET修剪 [ ^ ]
修剪,LTrim和RTrim功能 [ ^ ]
VBScript修剪功能 [ ^ ]
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 useTrim()
function of vb.net before assigning value to text box.
VB.NET Trim[^]
Trim, LTrim, and RTrim Functions[^]
VBScript Trim Function[^]
这篇关于在Sql我有表条例输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文