gummio
Posts: 11
|
Posted: 04/07/2004, 5:09 PM |
|
Hi,
I am trying to use this but i always get the following error:
Object required: 'DBBilakerfi'
This is the code i am using
Dim SQL
Dim RecordSet
Dim KmStada
Dim Mismunur
Dim BillID
DIM DBBilakerfi
KmStada = CCGetValue(Bilar_Kilometrastada, "KmStada")BillID = CCGetValue(Bilar_Kilometrastada, "Bill_ID")
If KmStada >=0 Then
SQL = "SELECT MAX(KmStada) As Mismun FROM Bilar_Kilometrastada WHERE Bill_ID ="&BillID& " KmStada < "&KmStada
Set RecordSet = DBBilakerfi.Execute(SQL)
If Bilakerfi.Errors.Count = 0 Then
If Not RecordSet.EOF then
Mismunur = CCGetValue(RecordSet, "Mismun")
End if
RecordSet.Close
Set RecordSet = Nothing
End If
End if
The reordset has only one record to return.
|
|
|
Tim
|
Posted: 04/07/2004, 7:06 PM |
|
You need to create the connection object first, or if this is taking place within a CCS event on a page which has database calls you should just use the existing connection, changing
Set RecordSet = DBBilakerfi.Execute(SQL)
to
Set RecordSet = DByourconnectionname.Execute(SQL)
even better you could not use the recordset at all and just assign a value like this
VariableToHoldValue = DByourconnectionname.Execute(SQL).fields(0).value
Good Luck.
|
|
|
peterr
Posts: 5971
|
Posted: 04/07/2004, 11:04 PM |
|
Please take a look at this example: http://docs.codecharge.com/studio/html/ProgrammingTechn...eCustomSQL.html
It shows how you can create the connection object.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
gummio
Posts: 11
|
Posted: 04/08/2004, 3:05 PM |
|
Thanks for the help, i got it to work
|
|
|
|