Public Function GetValue(ByVal StyleNO As Long) As Integer
Dim rsShowData As ADODB.Recordset
Dim sqlShowData As String
sqlShowData = "select count(*) as ReCount from "&_
"( select count(*) from t_TABLE "&_
"where styleid=" & StyleNO & " group by No) cc"
Set rsShowData = GetRecordSet(sqlShowData)
If Not rsShowData.EOF Then
GetValue = rsShowData("Recount")
Else
GetValue = 0
End If
End FunctionRun-time error '-2147217900(80040e14)':
No column was specified for column 1 of 'cc'.
Dim rsShowData As ADODB.Recordset
Dim sqlShowData As String
sqlShowData = "select count(*) as ReCount from "&_
"( select count(*) from t_TABLE "&_
"where styleid=" & StyleNO & " group by No) cc"
Set rsShowData = GetRecordSet(sqlShowData)
If Not rsShowData.EOF Then
GetValue = rsShowData("Recount")
Else
GetValue = 0
End If
End FunctionRun-time error '-2147217900(80040e14)':
No column was specified for column 1 of 'cc'.
解决方案 »
- 【散分】中秋国庆双节快乐
- VB与QQ的问题
- 关于身份证判断(textbox)
- 在vb的MDI主窗体中,怎样才能把窗体的“最大化”和“最小化”去掉。还有怎样才能让窗体不能自由拖动。
- 请问高手,如何得到一个目录的大小(或者说占用空间)?
- VB里读出数据库字段的类型,对于各种数据库完全不一致,而且有些都认不出来,郁闷郁闷真郁闷!
- 怎么把VB中text文本框内的多行数据导入到Excel中?在Excel中可以实现多行数据。
- 关于调用winscard.dll的问题,出参总是返回空值!
- 简单问题先到先得。
- 考!搞错没搞错,你也不会?不就是串行通讯吗?只不过多了一个"猫"!
- ◆◆VB里边有个函数可以对字符串进行翻转,请问那个函数是什么???
- 求比较全面的函数声明资料(shell32.dll)
"( select count(*)'这里应该是表名啊,你这样做电脑会报错啊,FRom后面要跟表名或者视图名
(Select Count(*) As Re From t_TABLE
Where styleid=" & StyleNO & "
Group by No) As cc
sqlShowData = "select count(*) as ReCount from "&_
"(select count(*) from t_TABLE "&_
"where styleid=" & StyleNO & " group by [No]) cc"
no是系统的保留字
也有试过将NO换成MYNO但是还是抱一样的错,这个查询是这样写的吗?请帮忙改正一下!
Dim rsShowData As adodb.Recordset
Set rsShowDate = New adodb.Recordset
Dim sqlShowData As String
sqlShowData = "select count(*) as ReCount from " _
& "(select count(*) from t_TABLE " _
& " where styleid=" & StyleNO & " group by No) cc"
Set rsShowData = GetRecordSet(sqlShowData)
If Not rsShowData.EOF Then
GetValue = Trim(rsShowData!Recount) & vbNullString
Else
GetValue = 0
End If
End Function
"(Select Count(*) As f1 From t_TABLE " & _
"Where styleid=" & StyleNO & " Group By No) cc"
(Select Count(*) As Re From t_TABLE
Where styleid=" & StyleNO & "
Group by [No]) As cc我在SQL上试过了,没问题。你贴我的语句试试。还要注意 styleid字段是int类型
因此CC前面应该加个AS
Public Function GetValue(ByVal StyleNO As Long) As Integer
Dim rsShowData As adodb.Recordset
Set rsShowDate = New adodb.Recordset
Dim sqlShowData As String
sqlShowData = "select count(*) as ReCount from t_TABLE " _
& " where styleid=" & StyleNO & " group by No"
Set rsShowData = GetRecordSet(sqlShowData)
If Not rsShowData.EOF Then
GetValue = Trim(rsShowData!Recount) & vbNullString
Else
GetValue = 0
End If
End Function