access queries

Results 1 to 2 of 2

Thread: access queries

  1. #1
    Join Date
    Dec 1969

    Default access queries

    can i use an access query instead of writing SQL when connecting to a database.

  2. #2
    Neil Popham Guest

    Default RE: access queries

    Yes. If you are returning records then use something like:<BR><BR>&#062; Set objRec=Server.CreateObject("ADODB.Recordset")<BR>& #062; objRec.Open "MyQuery", strConnect, adOpenForwardOnly, adLockReadOnly, adCmdStoredProc<BR><BR>If not, use something like:<BR><BR>&#062; Set objCommand=Server.CreateObject("ADODB.Command")<BR >&#062; objCommand.ActiveConnection=strConnect<BR>&#062; objCommand.CommandText="MyQuery"<BR>&#062; objCommand.CommandType=adCmdStoredProc<BR>&#062; objCommand.Execute<BR>&#062; Set objCommand=Nothing<BR><BR>strConnect is your connection string eg:<BR><BR>&#062; strConnect="DSN = MyDSN"<BR><BR>you will need to use the & file for the constants, or the code below will work without:<BR><BR>&#062; Set objRec=Server.CreateObject("ADODB.Recordset")<BR>& #062; objRec.Open "MyQuery", strConnect, 0, 1, &H0004

Posting Permissions

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