Foxtable(狐表)用户栏目专家坐堂 → 返回指定格式的string


  共有2706人关注过本帖树形打印复制链接

主题:返回指定格式的string

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110746 积分:563656 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/18 18:06:00 [显示全部帖子]

Dim cm As New SqlClient.SqlCommand("s elect 'A:'+ cast([A] as nvarchar) + ',B:'+ cast([B] as nvarchar) + ...... from [可用数量表]  where 订单号 = '" & ddh & "' and 订单行号 = '" & ddhh & "' and 物料编码 = '" & wlbm & "' and 两化表编号 = '" & lhbbh & "' and 软件版本 = '" & rjbb & "'", cn)

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110746 积分:563656 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/19 8:39:00 [显示全部帖子]

Public Function GetState1(ByVal ddh As String, ByVal ddhh As String, ByVal wlbm As String, ByVal lhbbh As String, ByVal rjbb As String) As String
Dim cnStr As String = "Data Source=(local);Initial Catalog=songjiang;Integrated Security=False;User ID=sa;Password=bdcom103liujy;"
Dim cn As New SqlClient.SqlConnection(cnStr)
cn.Open()
Dim cm As New SqlClient.SqlCommand("s elect * from [可用数量表]  where 订单号 = '" & ddh & "' and 订单行号 = '" & ddhh & "' and 物料编码 = '" & wlbm & "' and 两化表编号 = '" & lhbbh & "' and 软件版本 = '" & rjbb & "'", cn)
Dim dt As DataTable = cm.ExecuteReader
cn.Close()
Dim state As String
For Each dr As DataRow In dr.DataRow
    '拼接每行的数据
Next
Return state
End Function

 回到顶部
帅哥,在线噢!
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110746 积分:563656 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/28 10:19:00 [显示全部帖子]

vs的用法和foxtable不一样,找书或者上网先学学基本的用法

https://www.baidu.com/baidu?tn=02049043_69_pg&ie=utf-8&word=SqlDataAdapter

https://msdn.microsoft.com/zh-cn/library/system.data.sqlclient.sqldataadapter(VS.80).aspx

http://blog.sina.com.cn/s/blog_5c52ae1b0100q4uj.html

 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110746 积分:563656 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/28 10:39:00 [显示全部帖子]

    Public Function GetState1(ByVal ddh As String, ByVal ddhh As String, ByVal wlbm As String, ByVal lhbbh As String, ByVal rjbb As String) As String
        Dim cnStr As String = "Data Source=(local);Initial Catalog=songjiang;Integrated Security=False;User ID=sa;Password=bdcom103liujy;"
        Dim cn As New SqlClient.SqlConnection(cnStr)
        cn.Open()
        Dim adapter As New SqlClient.SqlDataAdapter("select * from [可用数量表]  where 订单号 = '" & ddh & "' and 订单行号 = '" & ddhh & "' and 物料编码 = '" & wlbm & "' and 两化表编号 = '" & lhbbh & "' and 软件版本 = '" & rjbb & "'", cn)

        Dim dt As New DataTable
        adapter.Fill(dt)
        cn.Close()
        Dim state As String = ""
        For Each dr As DataRow In dt.Rows
            state += "工单号:" + dr("工单号") + ",工单行号:" + dr("工单行号") + ",物料编码:" + dr("物料编码") + ",数量:" + dr("数量")
        Next
        Return state
    End Function

 回到顶部
帅哥,在线噢!
有点蓝
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110746 积分:563656 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/28 11:49:00 [显示全部帖子]

自己调试代码:https://www.baidu.com/baidu?tn=02049043_69_pg&ie=utf-8&word=vs+%E8%B0%83%E8%AF%95

state &= "工单号:" & dr("工单号") & ",工单行号:" & dr("工单行号") & ",物料编码:" & dr("物料编码") & ",数量:" & dr("数量") & vbcrlf

 回到顶部