0

I am using ASPMaker. It's a Classic ASP code generator. I am using MySQL database as well:

I am trying to get values from one table to another here's the code used to get the value from table1:

Dim Balance
Balance = ew_ExecuteScalar("SELECT Balance FROM [Balance] " )
ListOptions.GetItem("Balance").Body = Balance 

The problem is that I am getting only the last value for all records in the table. For example if the last [Balance] = 700, all the records in the table have [Balance] = 700.

Any idea?

Adi Inbar
  • 12,097
  • 13
  • 56
  • 69
  • I don't know ASPMaker, but if you want multiple records you need to create a recordset object and loop through it. Simple example here http://www.808.dk/?code-asp-db-loop – John Jan 09 '14 at 20:39
  • As the other @John said you might need a loop, but your function "ew_ExecuteScalar" implies that it returns a scalar result which is just a single value. Are you executing this query for all records? If so you will need to add a SQL where clause to select the right record. Is there a field in the Balance table that identifies a row in the other table? If so, change your query to something like "SELECT Balance FROM [Balance] WHERE [OtherTableID] = " & rsOtherTable("OtherTableID")) – johna Jan 10 '14 at 02:05

0 Answers0