ASP sql insert

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")

Who is Participating?
<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")

Have you tried printing strcis & strMName just before objRS.Open to see if they have a value?
ThinkPaperIT ConsultantCommented:
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!"
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?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.