vb6,ado,mdb,win 2k
i pass the sql string to the .Execute method on the open connection to
Table_Name(cons t) db table
fwiw
(the connection opened via class wrapper:)
msConnString = "Data Source=" & msDbFilename
moConn.Properti es("Persist Security Info") = False
moConn.Connecti onString = msConnString
moConn.CursorLo cation = adUseClient
moConn.Mode = adModeReadWrite ' or using default...same result
moConn.Open
can't seem to get my sql right
here's a few versions of the many ways i've tried with the resulting error
codes following each
' sSql = "Select Count(*) As 'Total' From " & TABLE_NAME & _
' " WHERE fldType.Value = '" & sType & "' AND " & _
' " fldCondName.Val ue = '" & sCond & "' AND " & _
' " fldCondVar.Valu e = '" & sCondVar & "' AND " & _
' " fldCondLBR.Valu e = '2L'"
'ErrState: -2147217904 (No value given for one or more required parameters.)
sSql = "Select Count(*) As 'Total' From " & TABLE_NAME & _
" WHERE fldTypeName.Val ue = '" & sType & "' AND " & _
" fldCondName.Val ue = '" & sCond & "' AND " & _
" fldCondVar.Valu e = '" & sCondVar & "' AND " & _
" fldCondLBR.Valu e = '2L' ORDER BY fldTypeName"
'ErrState: -2147217887 <You tried to execute a query that does not include
the specified expression 'fldTypeName' as part of an aggregate function.>
' sSql = "Select Count(*) From " & TABLE_NAME & _
' " WHERE fldTypeName.Val ue = '" & sType & "' AND " & _
' " fldCondName.Val ue = '" & sCond & "' AND " & _
' " fldCondVar.Valu e = '" & sCondVar & "' AND " & _
' " fldCondLBR.Valu e = '2L'"
'ErrState: -2147217904 (No value given for one or more required parameters.)
' sSql = "Select Count(*) From " & TABLE_NAME & _
' " WHERE " & TABLE_NAME & ".Fields.Item(' fldTypeName').V alue = '"
& sType & "' AND " & _
' TABLE_NAME & ".Fields.Item(' fldCondName').V alue = '" & sCond & "'
AND " & _
' TABLE_NAME & ".Fields.Item(' fldCondVar').Va lue = '" & sCondVar &
"' AND " & _
' TABLE_NAME & ".Fields.Item(' fldCondLBR').Va lue = '2L'"
'ErrState: -2147217900 (Invalid use of '.', '!', or '()'. in query
expression 'tblTypeCond.Fi elds.Item('fldT ypeName').Value = 'A' AND
tblTypeCond.Fie lds.Item('fldCo ndName').Value = '1' AND
tblTypeCond.Fie lds.Item('fldCo ndVar').Value = '3' AND
tblTypeCond.Fie lds.Item('fldCo ndLBR').Value = '2L''.)
' sSql = "Select Count(*) From " & TABLE_NAME & _
' " WHERE " & TABLE_NAME & ".Fields.Item(' fldTypeName').V alue = '"
& sType & "' AND " & _
' TABLE_NAME & ".Fields.Item(' fldCondName').V alue = '" & sCond & "'
AND " & _
' TABLE_NAME & ".Fields.Item(' fldCondVar').Va lue = '" & sCondVar &
"' AND " & _
' TABLE_NAME & ".Fields.Item(' fldCondLBR').Va lue = '2L'"
'ErrState: -2147217900 (Invalid use of '.', '!', or '()'. in query
expression 'tblTypeCond.Fi elds.Item('fldT ypeName').Value = 'A' AND
tblTypeCond.Fie lds.Item('fldCo ndName').Value = '1' AND
tblTypeCond.Fie lds.Item('fldCo ndVar').Value = '4' AND
tblTypeCond.Fie lds.Item('fldCo ndLBR').Value = '2L''.)
' sSql = "Select Count(*) From " & TABLE_NAME & _
' " WHERE " & TABLE_NAME & ".fldTypeName.V alue = '" & sType & "'
AND " & _
' TABLE_NAME & ".fldCondName.V alue = '" & sCond & "' AND " & _
' TABLE_NAME & ".fldCondVar.Va lue = '" & sCondVar & "' AND " & _
' TABLE_NAME & ".fldCondLBR.Va lue = '2L'"
'ErrState: -2147217904 (No value given for one or more required parameters.)
' sSql = "Select Count(*) From " & TABLE_NAME & _
' " WHERE " & TABLE_NAME & ".Fields.Item(' fldTypeName').V alue = '"
& sType & "' AND " & _
' TABLE_NAME & ".Fields.Item(' fldCondName').V alue = '" & sCond & "'
AND " & _
' TABLE_NAME & ".Fields.Item(' fldCondVar').Va lue = '" & sCondVar &
"' AND " & _
' TABLE_NAME & ".Fields.Item(' fldCondLBR').Va lue = ''2L''"
'ErrState: -2147217900 (Syntax error (missing operator) in query expression
'tblTypeCond.Fi elds.Item('fldT ypeName').Value = 'A' AND
tblTypeCond.Fie lds.Item('fldCo ndName').Value = '1' AND
tblTypeCond.Fie lds.Item('fldCo ndVar').Value = '4' AND
tblTypeCond.Fie lds.Item('fldCo ndLBR').Value = ''2L'''.)
eliminate the where clause maybe that's the problem?
'Try execute sql <Select Count(*) As 'Total' From tblTypeCond>
'ErrState: ErrNum 3265 (Item cannot be found in the collection corresponding
to the requested name or ordinal.)
yikes...what's the problem???
i'm running out of ideas
any help?
Thanks
Mark