Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 栏「;ColumnName";不属于表,处理datatable_Sql_Database_Vb.net - Fatal编程技术网

Sql 栏「;ColumnName";不属于表,处理datatable

Sql 栏「;ColumnName";不属于表,处理datatable,sql,database,vb.net,Sql,Database,Vb.net,我在后台使用vb.net和MS Access作为数据库。我得到“Column”ColumnName“不属于表”下面是我的代码: Dim comp As String Dim i As Integer = 1 For Each row As DataRow In crossTable.Rows For Each r As DataRow In pptTable.Rows

我在后台使用vb.net和MS Access作为数据库。我得到“Column”ColumnName“不属于表”下面是我的代码:

      Dim comp As String
            Dim i As Integer = 1
            For Each row As DataRow In crossTable.Rows
                For Each r As DataRow In pptTable.Rows
                    Dim l As Label = CType(Me.Controls("lbl" & i), Label)
                    Dim c As ComboBox = CType(Me.Controls("cbo" & i), ComboBox)
                    If c.Text <> "" Then
                        'Get the cell value at this row for the l.text columnname
                        comp = row("'" & l.Text & "'")
                        If c.Text <> comp Then
                            row.Delete()
                        End If
                    End If
                    i += 1
                Next
            Next
Dim comp As String
尺寸i为整数=1
对于crossTable.Rows中作为DataRow的每一行
对于pptTable.Rows中的每个r作为数据行
尺寸l作为标签=CType(Me.Controls(“lbl”)和i,标签)
Dim c As ComboBox=CType(Me.Controls(“cbo”&i),ComboBox)
如果c.文本“”则
'获取此行中l.text columnname的单元格值
comp=行(“”&l.Text&“”)
如果c.文本比较,则
行。删除()
如果结束
如果结束
i+=1
下一个
下一个

我有两个循环的数据表,当我到达comp=row(“'”&l.Text&“'))时,它给了我这个错误。我已经调试了好几次,我的交叉表有所有正确的列名和值,那么为什么在那一行它不识别该列名呢?非常感谢您的帮助。

看起来像是
l.Text
在某种程度上是“ColumnName”。我会在这里插入一个断点,并试图找出发生这种情况的时间和原因。我这样做了,它甚至显示了正确的列名,但我仍然不知道为什么它不起作用。无论如何,我做了一些工作,并得到了它。谢谢您的帮助。标签是否可能从0而不是1开始?通过添加控制台写入或msgBox(comp)来测试,以查看列名传递的内容。尝试
行。项(…)
而不仅仅是
行(…)
,现在,从我看到的情况来看,
“””&l.Text&“
将返回类似于
'mycl'
的内容。。。你确实想要
字符吗?lbl从1开始,也是第1行。项(..)不起作用,我在发布问题之前已经尝试过了,我最终以某种方式获得了列名的索引,并执行了第1行。项(索引)。但是我怎么能写“'”&l.Text&“'”,让它像想象的那样返回“Columnname”。