Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8517955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:51:02+00:00 2026-06-11T05:51:02+00:00

in my include folder I have the file SqlOperations.asp <% Option Explicit Function CheckSqlConnection()

  • 0

in my include folder I have the file SqlOperations.asp

<% 
    Option Explicit

    Function CheckSqlConnection()
        Dim sqlConnection, connString 
        connString = "Provider=SQLOLEDB.1;Persist Security Info=False; uid=sa; pwd=123456789;Initial Catalog=UserDatabase;Data Source=lakpa-pc"
        Err.Clear
        On Error Resume Next
        SET sqlConnection = Server.CreateObject("ADODB.Connection")
        sqlConnection.Open connString

        If Err.Number <> 0 Then
            CheckSqlConnection = false
        End If

        CheckSqlConnection = sqlConnection
        On Error Goto 0
    End Function

    Function ExecuteNonQuery(sqlQuery)
        Dim checkSql, sqlCmd
        checkSql = CheckSqlConnection
        If checkSql == False Then
            Response.Write("Please check your connection string <br/>" & vbCrlf)
            Response.End
            ExecutenonQuery = False
            Exit Function
        End If
        checkSql.Execute(sqlQuery) 
        ExecuteNonQuery = True
    End Function

 %>

then when I call it from UserInformation.asp which is in root folder

<!--#include file="include/SqlOperations.asp" -->
<%
    OPTION EXPLICIT

    dim fName, mName, lName,age,address,postCode,telephone, queryVal
    fName = Request.Form("fName")
    mName = Request.Form("mName")
    lName = Request.Form("lName")
    age = Request.Form("age")
    address= Request.Form("address")
    postCode = Request.Form("postCode")
    telephone = Request.Form("telephone")
    if fName <>"" then
        queryVal = "INSERT INTO UserInfo(FirstName, MiddleName, LastName, age, Address, PostCode, Telephone) VALUES('" + fName +"','" + mName+"','" + lName+"','" + age +"','" + address +"','" + postCode +"','" + telephone +"')"
        ExecuteNonQuery queryVal

    end if


 %>

The Debug isn’t working. But If I remove the include line then the debug works and I get the error

Microsoft VBScript runtime error: Variable is undefined: 'ExecuteNonQuery

I just don’t understand it. I am new to ASP classic. Can any one tell me the reason why its happening.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:51:04+00:00Added an answer on June 11, 2026 at 5:51 am

    Well the problem was the syntax, I was confused. I used “If checkSql == False Then”, the syntax was wrong it should have only one “=” sign. Well I modified little bit of it and now its working fine. This is for connecting ASP Classic with MSSQL. May be it will be helpful to somebody.
    Thanks Kane for the reply 🙂

      Function CheckSqlConnection()
        Dim sqlConnection, connString 
        connString = "Provider=SQLOLEDB.1;Persist Security Info=False; uid=sa; pwd=123456789;Initial Catalog=UserDatabase;Data Source=lakpa-pc"
        Err.Clear
        On Error Resume Next
        SET sqlConnection = Server.CreateObject("ADODB.Connection")
        sqlConnection.Open connString
    
        If Err.Number <> 0 Then
            CheckSqlConnection = false
        End If
    
        set CheckSqlConnection = sqlConnection
        On Error Goto 0
    End Function
    
    Function ExecuteNonQuery(sqlQuery)
        Dim checkSql
        set  checkSql = CheckSqlConnection
        If checkSql = False Then
            Response.Write("Please check your connection string <br/>" & vbCrlf)
            Response.End
            ExecutenonQuery = False
            Exit Function
        End If
        checkSql.Execute(sqlQuery) 
        ExecuteNonQuery = True
    End Function
    
    Sub SqlConnectionClose(SqlConn)
        SqlConn.Close()
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a folder include 10 excel files. Each of the excel file contain
I am trying to include a .js file into a php file. My folder
I have the following declaration in my build.xml file, in my src folder I
I have a php file and a bunch of HTML elements that include: header
I have file which needs to include blah.h in another project. I've tried adding
How do I require a file from the current folder? I have a file
I have a Visual Studio 2008 solution, and I would like to include a real folder
In Zend, inside the Library folder, I have a PHP file that I want
I have an MSI file which I include the following merge modules modules: <Merge
I have a file index.php in root directory: <?php require_once ./include/common.php; ?> and file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.