以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]换行符如何清除。 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=184380) |
-- 作者:dj68301367 -- 发布时间:2022/12/5 9:11:00 -- [求助]换行符如何清除。 J-1吉他咪:塑料上盖+下盖+按键(3个)+插嘴活动件+螺丝封盖(2个)+开关轴/ABS黑料/喷黑色(发射器塑料料下盖/丝印ON/OFF INPUT/丝印银油; 接收机塑料下盖/丝印ON/OFF OUTPUT/丝印银油)" 老师:内容如上红色字,在记事本中没 有看到有换行,在物料表编辑时也没有看到有,但在BOM明细中就看到有换行了。如何克服这种问题。
|
-- 作者:有点蓝 -- 发布时间:2022/12/5 9:36:00 -- 比如: dim s as string = "123" & vbcrlf & "abc" msgbox(s) s = s.replace(vbcr,"").replace(vblf,"") msgbox(s)
|
-- 作者:dj68301367 -- 发布时间:2022/12/5 15:49:00 -- Dim GGstr As String = e.NewValue GGstr = ggstr.replace(vbcr, "").replace(vblf, "") MessageBox.Show(ggstr) 老师代码如上红色字。msgbox 出来的结果是没有换行的,但实际在Table上是有换行的。我将字符串保存在文本上传,麻烦帮忙测试一下。 |
-- 作者:有点蓝 -- 发布时间:2022/12/5 15:56:00 -- 代码放在什么事件的?贴出完整代码 |
-- 作者:dj68301367 -- 发布时间:2022/12/5 17:01:00 -- 代码写在窗体表的DataColChanged Dim cmd As new SQLCommand cmd.C Dim dr As DataRow = e.DataRow Dim dt As DataTable = e.DataTable Dim tb As Table = Tables(dt.Name) Dim Gsdt As DataTable Dim Nstr As String = e.NewValue Select Case e.DataCol.Name Case "规格" Dim GGstr As String = e.NewValue GGstr = ggstr.replace(vbcr, "").replace(vblf, "") \' MessageBox.Show(ggstr) e.Form.Controls("Text规格").Text = ggstr Dim ggs() As String = GGstr.Split("/") If ggs.Length > 2 Then dr("品牌") = ggs(0) dr("客户型号") = ggs(1) End If |
-- 作者:dj68301367 -- 发布时间:2022/12/5 17:02:00 -- 保存代码: \'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cmd.CommandText = "sel ect * from {物料表} where [_Identify] is null" Dim SVdt As DataTable = cmd.ExecuteReader Dim lm As String,sz As String,cmdstr As String If r.IsNull("Itid") Then cmd.CommandText = " sel ect max(Itid) from {物料表} " Dim zs As Integer = cmd.ExecuteScalar r("Itid") = zs + 1 r("Fid") = 1 For Each dc As DataCol In svdt.DataCols If lm > "" Then lm &= "," lm &= "[" & dc.name & "]" If sz > "" Then sz &= "," sz &= "\'" & r(dc.Name) & "\'" Next If cmdstr > "" Then cmdstr &= ";" cmdstr &= "In sert In to {物料表} (" & lm &") Values (" & sz & ")" lm = Nothing sz = Nothing Else r("Fid") = 1 For Each dc As DataCol In svdt.DataCols If sz > "" Then sz &= "," sz &= dc.name & " =\'" & r(dc.Name) & "\'" Next If cmdstr > "" Then cmdstr &= ";" cmdstr &= " UPD ATE {物料表} SET " & sz & "WHERE itid =" & r("itid") sz = Nothing End If If cmdstr > "" Then cmd.Comm andText = cmdstr cmd.ExecuteNonQuery() MessageBox.Show("物料保存成功!", "提示", MessageBoxButtons.ok, MessageBoxIcon.Information) e.Form.Close End If |
-- 作者:有点蓝 -- 发布时间:2022/12/5 17:09:00 -- Select Case e.DataCol.Name Case "规格" Dim GGstr As String = e.NewValue GGstr = ggstr.replace(vbcr, "").replace(vblf, "") e.DataRow("规格" ) = GGstr \' MessageBox.Show(ggstr) e.Form.Controls("Text规格").Text = ggstr
|