Using VB2005 express. I am new to VB as I mostly programmed Access VBA only and struggle to find the right syntext to work with an ADO connection and retrieving a value from a record set
I get the following error message, but not sure what I am doing wrong here
I get the error message on RS!Result
Error 2 Overload resolution failed because no accessible 'Fields' accepts this number of arguments.
Code:
**********
Dim rs As New ADODB.Recordset
Dim Model As Integer
Dim InpHeat As Integer
Dim TempriseVal As Integer
Dim waterflow As Integer
Dim sqlstr As String
Model = SelectModel.SelectedValue
InpHeat = SelectInputHeat.SelectedValue
TempriseVal = SelectTempRise.SelectedValue
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and Settings\marius.breusers\My Documents\Visual Studio 2005\Projects\Heatrecovery\Heatrecovery.HeatRecovery.mdb;"
sqlstr = "SELECT tblWaterflow.Result FROM Tblwaterflow WHERE tblWaterflow.ModelId ='" & Model & "'And tblWaterflow.Inputheat =" & InpHeat & " And tblWaterflow.Temprise =" & TempriseVal & ""
With MasterDbConn
'rs.Open(sqlstr, MasterDbConn, adOpenStatic, adLockReadOnly, adCmdText)
rs.Open(sqlstr, MasterDbConn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly)
'rs.Open("SELECT * FROM Tblwaterflow WHERE ModelId = SelectModel And Inputheat ='" & SelectInputHeat & "' And Temprise ='" & SelectTempRise & "' , MasterDbConn, adOpenStatic, adLockReadOnly, adCmdText)
If Not rs.EOF And Not rs.BOF Then
rs.MoveFirst()
If rs!result <> 0 Then
waterflow = rs!Result
End If
End If
rs.Close()
******
I get the error message on RS!Result
Error 2 Overload resolution failed because no accessible 'Fields' accepts this number of arguments.
I get the following error message, but not sure what I am doing wrong here
I get the error message on RS!Result
Error 2 Overload resolution failed because no accessible 'Fields' accepts this number of arguments.
Code:
**********
Dim rs As New ADODB.Recordset
Dim Model As Integer
Dim InpHeat As Integer
Dim TempriseVal As Integer
Dim waterflow As Integer
Dim sqlstr As String
Model = SelectModel.SelectedValue
InpHeat = SelectInputHeat.SelectedValue
TempriseVal = SelectTempRise.SelectedValue
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and Settings\marius.breusers\My Documents\Visual Studio 2005\Projects\Heatrecovery\Heatrecovery.HeatRecovery.mdb;"
sqlstr = "SELECT tblWaterflow.Result FROM Tblwaterflow WHERE tblWaterflow.ModelId ='" & Model & "'And tblWaterflow.Inputheat =" & InpHeat & " And tblWaterflow.Temprise =" & TempriseVal & ""
With MasterDbConn
'rs.Open(sqlstr, MasterDbConn, adOpenStatic, adLockReadOnly, adCmdText)
rs.Open(sqlstr, MasterDbConn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly)
'rs.Open("SELECT * FROM Tblwaterflow WHERE ModelId = SelectModel And Inputheat ='" & SelectInputHeat & "' And Temprise ='" & SelectTempRise & "' , MasterDbConn, adOpenStatic, adLockReadOnly, adCmdText)
If Not rs.EOF And Not rs.BOF Then
rs.MoveFirst()
If rs!result <> 0 Then
waterflow = rs!Result
End If
End If
rs.Close()
******
I get the error message on RS!Result
Error 2 Overload resolution failed because no accessible 'Fields' accepts this number of arguments.