是否有另一种方法可以删除命令内部的空格?
这是我的代码:
cmd.CommandText = "SELECT Stud_ID, LCase(Stud_Fname)&LCase(Stud_Lname) AS name FROM tbl_Student";
OleDbDataReader reader1 = cmd.ExecuteReader();
while (reader1.Read()){
Console.WriteLine(reader1[1].ToString());
}
reader1.Close();
我想实现的预期投票是在此处输入图像描述 Stud_fname和lname将组合,并且将是小写。但是我的问题是,我需要用2个给定名称(例如Dela Cruz)删除名称之间的空格。应该是Delacruz。我尝试的是.replace();和.trim()但行不通的人可以帮助我。建议我该怎么办?
This is my code:
cmd.CommandText = "SELECT Stud_ID, LCase(Stud_Fname)&LCase(Stud_Lname) AS name FROM tbl_Student";
OleDbDataReader reader1 = cmd.ExecuteReader();
while (reader1.Read()){
Console.WriteLine(reader1[1].ToString());
}
reader1.Close();
The expected out put that I want to achieve was enter image description here the Stud_Fname and Lname will combine and it will be as lowerCase. but my problem was I need to removed the whitespace between the name with 2 given name such as Dela Cruz. It should be delacruz . What I tried is the .Replace(); and .Trim() but it didn't work can someone help me. suggest what should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
替换
应该有效:Replace
should work:这对我有用:
因此,我们以名字或姓氏为单位删除所有空间。
This works for me:
So, we remove all spaces - in first or last name.