ASP sql insert

Posted on 2006-05-02
Last Modified: 2012-06-27
Im trying to submit data into an SQL database.

It works but two values show up with no value

Here is my statement

objRS.Open "Insert into reqtbl (Mname, cmpsub, codeline, bldlabel, Nullcis) Values ('" & strMName & "','" & strcmpname & "','" & stros & "','" & strbuild & "','"& strcis & "')",objConnection,3,3

The "Mname" does not show up and the "cis"

mname comes from

 if not(request.form("MName")="" or IsNull(request.form("MName"))) then
   Session("UserName") = request.form("MName")


cis comes from

do while not objRS.EOF
                    if objRS("cis") = strBuild then
                         strSelected = " Checked "
                         strSelected = ""
                    end if
      <td width="700" style="word-wrap:break-word;"><input type=checkbox name=cis value="<%=objRS("cis")%>"style="font-size:8px;"></td>

then I do a

dim strcis, strMName

strcis = Request.Form("cis")
strMName = Request.Form("MName")

Question by:tmurray22
    LVL 3

    Expert Comment

    Have you tried printing strcis & strMName just before objRS.Open to see if they have a value?
    LVL 16

    Expert Comment

    do a response.write on your values at the beginning of your code and see if it's actually passing. I tend to put a "!!" at the end so I know that it actually printed out if it comes out blank.

    response.write Request.Form("MName") & "!!MNAme"
    response.write Request.Form("cis")  & "!!CIS!"
    LVL 6

    Expert Comment

    i see you give the value to cis in a checkBox, but i don't see where you give the value to MName, you also have a checkBox for this value?
    LVL 1

    Accepted Solution

    <input type=checkbox name=cis value="<%=objRS("cis")%>"style="font-size:8px;"></td>

    I think your code here put wrong value?

    should replace the value with strSelected
    <input type=checkbox name=cis value="<%=strSelected%>"style="font-size:8px;"></td>


    Try to change this
    "if objRS("cis") = strBuild then"


    IF strComp(objRS("cis")),strBuild)=0 THEN

    to do a string comparison if it is your case.

    For the MNAme,

    With your code,
    if not(request.form("MName")="" or IsNull(request.form("MName"))) then
       Session("UserName") = request.form("MName")

    strMName = Request.Form("MName")  <-- this one should change to Session("UserName")

    and become

    strMName = Session("UserName")


    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
    I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now