Active Server Pages Programming (ASP)/Calling a function within an ASP Page

Advertisement


Question
Hi...
I am calling a function or sub if u may call it from within the same page.
it works fine until i execute a ado command object.
as soon as i put the execute statement in the page, all activites stop and the page doesnt execute any further from the line calling that function.
can u help me plz?
I use SQL server 2000 thru adodb from ASP page


Answer
Hi

Sorry for the delay...  here is the simple example how to use this

fsSQL = "SELECT * FROM Table "
Set fsTmp = SQLGetRS(fsSQL)      

Function SQLGetRS(ByVal SQL)
  Dim rs
  Dim conn
  Err.number = 0
  Set conn = CreateObject("ADODB.Connection")

  'open connection and execute query
  conn.Open Application("ConnectionString")
  Set rs = conn.Execute(SQL, , 1)

  Set rs.ActiveConnection = Nothing
  Set conn = Nothing
      
  'return the results
  Set SQLGetRS = rs

  Set rs = Nothing
End Function

Try like this...

-srini

Active Server Pages Programming (ASP)

All Answers


Answers by Expert:


Ask Experts

Volunteer


Srini Nagarajan

Expertise

I can answer any kind of questions in ASP.NET, C#, VB.NET, SharePoint 2007, ASP, Coldfusion, Powerbuilder 7.00 / 8.00, JAVA servlets, MS SQL 2000 / MSSQL7, Sybase

Experience

Contact me if you need any custom development on ASP.NET, ASP, SharePoint 2007, Coldfusion, Powerbuilder.

©2012 About.com, a part of The New York Times Company. All rights reserved.