Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 12th, 2004, 07:54 AM
Registered User
 
Join Date: May 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help Urgent

<%@ Language=VBScript %>

<%
Response.Buffer =true
Response.Flush()
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">

<BODY>
<form name="frmProjSave" Method="Post" Action="ProjEdit.asp">
<script language='Javascript'>
    function goBack(projname,lotno)
    {
        frmProjSave.cboProjName.value=projname;
        frmProjSave.cboLotno.value =lotno;
        frmProjSave.action='ProjEdit.asp';
        frmProjSave.submit();
    // window.close();
    }
</script>
<%
Dim sqlSelect,rsSelect
Set rsSelect=Server.CreateObject("ADODB.Recordset")

If Request.Form("cboTopology")<>"" Then cboTopology=Request.Form("cboTopology")
If Request.Form("cboReliability")<>"" Then cboReliability=Request.Form("cboReliability")

If Request.Form("txtProjectName")<>"" Then
    sql="Select * from mas_Project where Project_Name='"&Trim(Ucase(Request.Form("txtProjec tName")))&"' and Lotno='"&Trim(Request.Form("hdLotno"))&"'"
    If rsSelect.State=1 Then rsSelect.Close
    rsSelect.Open sql,DataConn,1,2
    If rsSelect.RecordCount >0 Then
        ProjectNo=rsSelect.Fields("ProjectNo")
        sql="Delete from det_Structure Where ProjectNo="&ProjectNo&" and Structure_Name='"&Trim(UCase(Request.Form("txtStru cName"))) &"'"
        DataConn.Execute sql
        sql="Delete from det_StrucDetails Where ProjectNo="&ProjectNo&" and Structure_Name='"&Trim(UCase(Request.Form("txtStru cName"))) &"'"
        DataConn.Execute sql

        sql="Insert into det_Structure values ('"&Trim(UCase(Request.Form("txtStrucName"))) &"',"_
            & ProjectNo &",'"&Trim(Request.Form("hdLotno"))&"',"&Trim(Requ est.Form("txtNoofCond")) &",'"_
            & Trim(Request.Form("txtWidth")) &"','"&Trim(Request.Form("cboTopology"))&"','"_
            & Trim(Request.Form("cboReliability")) &"','"&Trim(Request.Form("txtStrucLayout"))&"', '"_
            & Trim(Request.Form("optLayout")) &"','"&Trim(Request.Form("optStruc"))&"','"_
            & Trim(Request.Form("txtPacakage")) &"','"&Trim(Request.Form("txtTempDesign"))&"',' "_
            & Trim(Request.Form("txtCurrentDesign")) &"','"&Trim(Request.Form("txtEa"))&"','"_
            & Trim(Request.Form("txtN")) &"','"&Trim(Request.Form("txtSigma"))&"','"&Reques t.Form("txtGoal")&"')"
        DataConn.Execute sql

    STemps=Request.Form("txtTemp")
    SDenses=Request.Form("txtDensity")
    SCurrents=Request.Form("txtCurrent")
    T50s=Request.Form("txtT50")
    Sizes1=Request.Form("txtSamplesize1")
    Factors=Request.Form("txtFactor")
    Tests=Request.Form("txtTestTime")
    Days=Request.Form("txtTestDays")


    STemp=Split(STemps,",")
    SDense=Split(SDenses,",")
    SCurrent=Split(SCurrents,",")
    T50=Split(T50s,",")
    Size1=Split(Sizes1,",")
    Factor=Split(Factors,",")
    Test=Split(Tests,",")
    Day1=Split(Days,",")

    '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
    ' To store singleton values
    '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
    If Trim(STemp(0))<>"" and Trim(SDense(0))<>"" and Trim(SCurrent(0))<>"" and Trim(T50(0))<>"" _
        and Trim(Size1(0))<>"" and Trim(Factor(0))<>"" and Trim(Test(0))<>"" and Trim(Day1(0))<>"" Then
        sql="Insert into det_StrucDetails values('"&Trim(UCase(Request.Form("txtStrucName")) ) &"',"_
           & ProjectNo & ",'"& Trim(STemp(0)) &"','"& Trim(SDense(0))&"','"&Trim(SCurrent(0))&"','" _
           & Trim(T50(0)) &"','"& Trim(Size1(0)) &"','"&Trim(Factor(0))&"','"&Trim(Test(0))&"',"&Tr im(Day1(0))&",NULL,NULL,NULL)"
        DataConn.Execute sql
     End If
    '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''


    For i=1 To (Request.Form("txtTemp").Count -1)
     If Trim(STemp(i))<>"" and Trim(SDense(i))<>"" and Trim(SCurrent(i))<>"" and Trim(T50(i))<>"" _
        and Trim(Size1(i))<>"" and Trim(Factor(i))<>"" and Trim(Test(i))<>"" and Trim(Day1(i))<>"" Then
        sql="Insert into det_StrucDetails values('"&Trim(UCase(Request.Form("txtStrucName")) ) &"',"_
           & ProjectNo & ",'"& Trim(STemp(i)) &"','"& Trim(SDense(i))&"','"&Trim(SCurrent(i))&"','" _
           & Trim(T50(i)) &"','"& Trim(Size1(i)) &"','"&Trim(Factor(i))&"','"&Trim(Test(i))&"',"&Tr im(Day1(i))&",NULL,NULL,NULL)"
        DataConn.Execute sql
     End If
    Next
 Else
    sql="Insert into mas_Project(Project_Name,Lotno,Status) values ('"&Trim(Ucase(Request.Form("txtProjectName")))&"' ,'"&Trim(Request.Form("hdLotno"))&"',0)"
    DataConn.Execute sql

    sql="Select * from mas_Project where Project_Name='"&Trim(Ucase(Request.Form("txtProjec tName")))&"' and Lotno='"&Trim(Request.Form("hdLotno"))&"'"
    If rsSelect.State=1 Then rsSelect.Close
    rsSelect.Open sql,DataConn,1,2
    If rsSelect.RecordCount >0 Then
        ProjectNo=rsSelect.Fields("ProjectNo")
        sql="Delete from det_Structure Where ProjectNo="&ProjectNo&" and Structure_Name='"&Trim(UCase(Request.Form("txtStru cName"))) &"'"
        DataConn.Execute sql
        sql="Delete from det_StrucDetails Where ProjectNo="&ProjectNo&" and Structure_Name='"&Trim(UCase(Request.Form("txtStru cName"))) &"'"
        DataConn.Execute sql

        sql="Insert into det_Structure values ('"&Trim(UCase(Request.Form("txtStrucName"))) &"',"_
            & ProjectNo &",'"&Trim(Request.Form("hdLotno"))&"',"&Trim(Requ est.Form("txtNoofCond")) &",'"_
            & Trim(Request.Form("txtWidth")) &"','"&Trim(Request.Form("cboTopology"))&"','"_
            & Trim(Request.Form("cboReliability")) &"','"&Trim(Request.Form("txtStrucLayout"))&"', '"_
            & Trim(Request.Form("optLayout")) &"','"&Trim(Request.Form("optStruc"))&"','"_
            & Trim(Request.Form("txtPacakage")) &"','"&Trim(Request.Form("txtTempDesign"))&"',' "_
            & Trim(Request.Form("txtCurrentDesign")) &"','"&Trim(Request.Form("txtEa"))&"','"_
            & Trim(Request.Form("txtN")) &"','"&Trim(Request.Form("txtSigma"))&"','"&Reques t.Form("txtGoal")&"')"
        DataConn.Execute sql

    STemps=Request.Form("txtTemp")
    SDenses=Request.Form("txtDensity")
    SCurrents=Request.Form("txtCurrent")
    T50s=Request.Form("txtT50")
    Sizes1=Request.Form("txtSamplesize1")
    Sizes2=Request.Form("txtSamplesize2")
    Factors=Request.Form("txtFactor")
    Tests=Request.Form("txtTestTime")
    Days=Request.Form("txtTestDays")


    STemp=Split(STemps,",")
    SDense=Split(SDenses,",")
    SCurrent=Split(SCurrents,",")
    T50=Split(T50s,",")
    Size1=Split(Sizes1,",")
    Size2=Split(Sizes2,",")
    Factor=Split(Factors,",")
    Test=Split(Tests,",")
    Day1=Split(Days,",")

    '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
    ' To store singleton values
    '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
    If Trim(STemp(0))<>"" and Trim(SDense(0))<>"" and Trim(SCurrent(0))<>"" and Trim(T50(0))<>"" _
        and Trim(Size1(0))<>"" and Trim(Factor(0))<>"" and Trim(Test(0))<>"" and Trim(Day1(0))<>"" Then
        sql="Insert into det_StrucDetails values('"&Trim(UCase(Request.Form("txtStrucName")) ) &"',"_
           & ProjectNo & ",'"& Trim(STemp(0)) &"','"& Trim(SDense(0))&"','"&Trim(SCurrent(0))&"','" _
           & Trim(T50(0)) &"','"& Trim(Size1(0)) &"','"&Trim(Factor(0))&"','"&Trim(Test(0))&"',"&Tr im(Day1(0))&",NULL,NULL,NULL)"
        DataConn.Execute sql
     End If
    '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''

    For i=1 To (Request.Form("txtTemp").Count -1)
     If Trim(STemp(i))<>"" and Trim(SDense(i))<>"" and Trim(SCurrent(i))<>"" and Trim(T50(i))<>"" _
        and Trim(Size1(i))<>"" and Trim(Factor(i))<>"" and Trim(Test(i))<>"" and Trim(Day1(i))<>"" Then
        sql="Insert into det_StrucDetails values('"&Trim(UCase(Request.Form("txtStrucName")) ) &"',"_
           & ProjectNo & ",'"& Trim(STemp(i)) &"','"& Trim(SDense(i))&"','"&Trim(SCurrent(i))&"','" _
           & Trim(T50(i)) &"','"& Trim(Size1(i)) &"','"&Trim(Factor(i))&"','"&Trim(Test(i))&"'," & Trim(Day1(i))&",NULL,NULL,NULL)"
        DataConn.Execute sql
     End If
    Next
  End If



 End If
End If
If Trim(Request.Form("ProjectNo"))<>"" Then
    sql="Select * from mas_Project Where ProjectNo="& ProjectNo & " and Lotno='"&Trim(Request.Form("hdLotno"))&"'"
    If rsSelect.State =1 Then rsSelect.Close
    rsSelect.Open sql,DataConn,1,2
End If


%>
<br><br><h2 align=center>The Structure has been saved successfully </h2><br>

<%If Trim(Request.Form("hdFlag"))="New" Then %>
    <center><input type=button name=btnClose value=" Close " onclick='javascript:window.close()'></center>
<%Else%>
    <center><input type=button name=<%=rsSelect.Fields("Project_Name")%> id="<%=rsSelect.Fields("LotNo")%>" value=" Close " onclick='goBack(this.name,this.id)'></center>
<%End If%>
<input type=hidden name=cboProjName>
<input type=hidden name=cboLotno>
</form>
</BODY>

</HTML>

This is wat i haf for my database.
Assume all data is valid, and my connection to database is correct.
as seen as above, i haf 3 tables here, but why when i click submit, the database all save in a table only, tat is mas_project. help me??

Another problem, different case is when i type the code below
=request.form("txtlotno")
and put it in the end of the code. I can get the value display on the screen, but when i hope to save insert into my database, it come out error like

det_structsure.lotno cannot haf zero length string

y??







Similar Threads
Thread Thread Starter Forum Replies Last Post
urgent deb_kareng ASP.NET 2.0 Professional 1 August 13th, 2007 07:29 AM
it's urgent deb_kareng ASP.NET 2.0 Professional 3 August 7th, 2007 07:40 AM
urgent help yash_coolbuddy_forindia BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 May 7th, 2007 08:40 AM
urgent???????????? nsr35 Beginning VB 6 1 October 3rd, 2005 10:57 AM
urgent ??????????????? nsr35 Pro VB Databases 0 October 3rd, 2005 04:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.