ziggy00001
Programmer
Can anyone see anything wrong with this set of code.
I have tested the SQL Statement and it returns the correct Balance, which = $422.63.
Where I beleive I am faultering is passing the recordset to the variable.
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=sqloledb;Data Source=(local);Initial Catalog=Lileo1;User Id=sa;Password=sa;"
Set RS = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT Balance FROM Voucher INNER JOIN VoucherEntry ON Voucher.ID = VoucherEntry.VoucherID LEFT JOIN Item ON Item.ID = Voucher.ItemID LEFT JOIN [Transaction] ON VoucherEntry.TransactionNumber = [Transaction].TransactionNumber LEFT JOIN Customer ON [Transaction].CustomerID = Customer.ID WHERE Customer.ID = " & CurrentCust & ""
RS.Open SQL, Conn
Custom2 = RS("Balance")
RS.Close
Set RS = Nothing
Conn.Close
Set Conn = Nothing
txtCustom2.innerText = Custom2
I have tested the SQL Statement and it returns the correct Balance, which = $422.63.
Where I beleive I am faultering is passing the recordset to the variable.
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=sqloledb;Data Source=(local);Initial Catalog=Lileo1;User Id=sa;Password=sa;"
Set RS = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT Balance FROM Voucher INNER JOIN VoucherEntry ON Voucher.ID = VoucherEntry.VoucherID LEFT JOIN Item ON Item.ID = Voucher.ItemID LEFT JOIN [Transaction] ON VoucherEntry.TransactionNumber = [Transaction].TransactionNumber LEFT JOIN Customer ON [Transaction].CustomerID = Customer.ID WHERE Customer.ID = " & CurrentCust & ""
RS.Open SQL, Conn
Custom2 = RS("Balance")
RS.Close
Set RS = Nothing
Conn.Close
Set Conn = Nothing
txtCustom2.innerText = Custom2