Database Results

Results 1 to 2 of 2

Thread: Database Results

  1. #1
    Join Date
    Dec 1969

    Default Database Results

    I was wondering if there was a way of assigning a database result to a variable in asp so that I could manipulate the data. eg If the first database result passed from the database was <<2000 Sales>> and the second was <<2000 Forecast Sales>> could I assign then to a variable so that I could minus them from one another to give me my output. Or is there another way that I could use to manipulate the output.

  2. #2
    Jason Guest

    Default RE: Database Results

    If I understand correctly, you want to do some mathematical processing with the results you get back from a query? If that is correct then...<BR><BR>&#060;%<BR><BR>Dim Sales2000<BR>Dim ForeCastSales2000<BR>Dim DiffSales<BR><BR>Set db = Server.CreateObject("adodb.Connection")<BR>db.Open "dsn=&#060;dsn name&#062;;uid=&#060;uid&#062;;pwd=&#060;psw&#062; "<BR><BR>set rs = server.createobject("ADODB.Recordset")<BR>sql = "Select * from &#060;some table&#062;"<BR> sql, db<BR><BR>Do while Not rs.eof<BR>Sales2000 = rs("2000 Sales")<BR>ForeCastSales2000 = rs("2000 Forecast Sales")<BR>DiffSales = Sales2000 - ForeCastSales2000<BR>&#060;...write data to page - response.write&#062;<BR>Loop<BR>%&#062;<BR><BR>Is that what you where looking for?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts