以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  数据更新  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=67434)

--  作者:qianqian1530
--  发布时间:2015/4/24 9:32:00
--  数据更新
为真么 总是说找不到  Cols1() 组里的表呢?

DataSource 数据库里面有啊, (不在胡表里.)

\'\'\'
\'数据更新
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.C
Dim Cols1() As String = {"administrator_st_Data","administrator_st_Amazon","administrator_st_Yahoo","administrator_st_Rakuten"}
Dim Cols2() As String = {"st_Data","st_Amazon","st_Yahoo","st_Rakuten"}
Dim Cols3() As String = {"商品型番","sku","code","商品番号"}
For i As Integer = 0 To Cols1.Length -1
    cmd.CommandText = "SE LECT * From {" & Cols1(i) & "}"
    dt = cmd.ExecuteReader()
e.Form.Controls("TextBox33").text & =VbCrLf &  Date.now & VbCrLf  & " ∟导入" & Cols1(i)
    For Each dr1 As DataRow In dt.DataRows
        Dim dswr As DataRow = DataTables(Cols2(i)).Find("[" & Cols3(i) & "] = \'" & dr1(Cols3(i)) & "\'")
        If dswr IsNot Nothing Then
        Else
            Dim dr2 As DataRow = DataTables(Cols2(i)).AddNew()
            For Each dc As DataCol In DataTables(Cols1(i)).DataCols
                dr2(dc.Name) = dr1(dc.name)
            Next
        End If
    Next
Next
Application.DoEvents()

--  作者:Bin
--  发布时间:2015/4/24 9:33:00
--  
外部数据源? 没有指定数据源名称


--  作者:qianqian1530
--  发布时间:2015/4/24 10:04:00
--  
我设置了,   网页里不现实 ``  
--  作者:qianqian1530
--  发布时间:2015/4/24 10:05:00
--  
\'\'\'
\'数据更新
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.Connectio nName = "DataSource"
Dim Cols1() As String = {"administrator_st_Data","administrator_st_Amazon","administrator_st_Yahoo","administrator_st_Rakuten"}
Dim Cols2() As String = {"st_Data","st_Amazon","st_Yahoo","st_Rakuten"}
Dim Cols3() As String = {"商品型番","sku","code","商品番号"}
For i As Integer = 0 To Cols1.Length -1
    cmd.CommandText = "SE LECT * From {" & Cols1(i) & "}"
    dt = cmd.ExecuteReader()
e.Form.Controls("TextBox33").text & =VbCrLf &  Date.now & VbCrLf  & " ∟导入" & Cols1(i)
    For Each dr1 As DataRow In dt.DataRows
        Dim dswr As DataRow = DataTables(Cols2(i)).Find("[" & Cols3(i) & "] = \'" & dr1(Cols3(i)) & "\'")
        If dswr IsNot Nothing Then
        Else
            Dim dr2 As DataRow = DataTables(Cols2(i)).AddNew()
            For Each dc As DataCol In DataTables(Cols1(i)).DataCols
                dr2(dc.Name) = dr1(dc.name)
            Next
        End If
    Next
Next
Application.DoEvents()

--  作者:Bin
--  发布时间:2015/4/24 10:06:00
--  
确定表名正确无误,也设置了数据源,那不可能的哦.

错误提示发出来看看.

--  作者:狐狸爸爸
--  发布时间:2015/4/24 10:09:00
--  
提示那个表名不存在,就检查那个表名,系统不会撒谎,注意这个表名是后台的表名,假定Foxtable的表B来自与后台的表C,写SQL语句的时候,应该用表C
[此贴子已经被作者于2015/4/24 10:09:16编辑过]

--  作者:qianqian1530
--  发布时间:2015/4/24 10:12:00
--  
  ```

图片点击可在新窗口打开查看此主题相关图片如下:360桌面截图20150424110957.jpg
图片点击可在新窗口打开查看


--  作者:Bin
--  发布时间:2015/4/24 10:13:00
--  
联系客服远程看看  800014337
--  作者:qianqian1530
--  发布时间:2015/4/24 10:17:00
--  
Bin ,
是  

For Each dc As DataCol In DataTables(Cols1(i)).DataCols
                dr2(dc.Name) = dr1(dc.name)
 Next
这句话里的   DataTables(Cols1(i)).DataCols  这个代码有问题, 要怎么修改啊

--  作者:Bin
--  发布时间:2015/4/24 10:18:00
--  
你这里取的是狐表的表,并不是数据源里的表,那么就不应该用COLS1 因为你这个数组存的都是数据源里的表名称啊


这里你应该用狐表里的表名称才对