Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases 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 March 30th, 2004, 03:39 PM
Authorized User
 
Join Date: Aug 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default plz help me solve this error

I am submiiting product details but getting errors...anyone plz help me my code is

<%@ Language=VBScript %>
<%
If Session("blnIsUserGood") = False or IsNull(Session("blnIsUserGood")) = True then

    Response.Redirect"admin.asp"
End If
%>


<%
dim username

username= session("username")

dim ptitle
ptitle = trim(Request.Form("p_title"))
response.write ptitle


dim pcode
pcode = trim(Request.Form("pcode"))
response.write pcode

dim description
description = trim(Request.Form("description"))
response.write description

dim cost
cost = trim(Request.Form("cost"))
response.write cost

dim price
price = trim(Request.Form("price"))
response.write price

dim sale
sale = trim(Request.Form("sale"))
response.write sale


dim thumbimg
thumbimg = trim(Request.Form("thumbimg"))
response.write thumbimg

dim largeimg
largeimg = trim(Request.Form("largeimg"))
response.write largeimg

dim largerimg
largerimg = trim(Request.Form("largerimg"))
response.write largerimg

dim catid
catid = trim(Request.Form("catid"))
response.write catid


dim subid
subid = trim(Request.Form("subid"))
response.write subid

dim colorimg
colorimg = trim(Request.Form("colorimg"))
response.write colorimg

dim mfrid
mfrid = trim(Request.Form("mfrid"))
response.write mfrid

dim supid
supid= trim(Request.Form("supid"))
response.write supid

dim avail
avail= lcase(trim(Request.Form("avail")))
response.write avail


dim delivery
delivery = trim(Request.Form("delivery"))
response.write delivery

dim stock
stock = lcase(trim(Request.Form("stock")))
response.write stock

dim interest1
interest1 = trim(Request.Form("interest1"))
response.write interest1

dim interest2
interest2 = trim(Request.Form("interest2"))
response.write interest2

dim interest3
interest3 = trim(Request.Form("interest3"))
response.write interest3

dim interest4
interest4 = trim(Request.Form("interest4"))
response.write interest4

dim interest5
interest5 = trim(Request.Form("interest5"))
response.write interest5

dim interest6
p_title = trim(Request.Form("interest6"))
response.write interest6

Dim SQL
'SQL="select * from product"
SQL="select * from product where p_code =" & pcode & " and p_title ='" & p_title & "' order by prodid"

dim rs1
Set rs1 = Server.CreateObject("ADODB.Recordset")
rs1.open SQL,objConn

if not rs1.EOF then %>
<tr>
     <td valign="top" bgcolor="#FFFFFF" align="center">

    <b><br>Product with product code <U><% response.write pcode %></U> already exists !!!

    </td>
   </tr>

<%
else

dim sqladd

sqladd="insert into product values('" & ptitle & "'," & pcode & ",'" & description & "'," & sale & "," & price & "," & cost & ",'" & thumbimg & "','" & largeimg & "','" & largerimg & "'," & catid & "," & subid & ",'" & colorimg & "'," & mfrid & "," & supid & " ,'" & avail & "'," & delivery & ",'" & stock & "'," & interest1 & "," & interest2 & "," & interest3 & "," & interest4 & "," & interest5 & "," & interest6 & ")"
Response.Write sqladd
'objConn.Execute sqladd

dim strsql
strsql="insert into product(p_title,p_code,description,sale,price,cost ,thumbimg,largeimg,largerimg,catid,subid,colorimg, mfrid,supid,availability,delivery,stock,interest1, interest2,interest3,interest4,interest5,interest6) values('"
            strsql= strsql & ptitle & "',"
            strsql= strsql & pcode & ",'"
            strsql= strsql & description & "',"
            strsql= strsql & sale & ","
            strsql= strsql & price & ","
            strsql= strsql & cost & ",'"
            strsql= strsql & thumbimg & "','"
            strsql= strsql & largeimg & "','"
                        strsql= strsql & largerimg & "',"
                        strsql= strsql & catid & ","
                        strsql= strsql & subid & ",'"
                        strsql= strsql & colorimg & "',"
                        strsql= strsql & mfrid & ","
                        strsql= strsql & supid & ",'"
                        strsql= strsql & avail & "',"
                        strsql= strsql & delivery & ",'"
                        strsql= strsql & stock & "',"
                        strsql= strsql & interest1 & ","
                        strsql= strsql & interest2 & ","
                        strsql= strsql & interest3 & ","
                        strsql= strsql & interest4 & ","
                        strsql= strsql & interest5 & ","
                     strsql= strsql & interest6 & " )"
            Response.Write strsql
            objConn.Execute (strsql)



dim rs2
rs2=Server.CreateObject("ADODB.Recordset")
dim sql2
sql2="select max(prodid) as prodid from product"
'rs2.open sql2, objconn

'if not rs2.eof= true then
'dim pid
'pid= rs2.fields(0)


'dim sqladd1
    'sqladd1="insert into stock(pid,bought,sold,available) values(" & pid & "," & bought & " ," & sold & "," & available & ") "
    'Response.Write(sqladd1)
    'objConn.Execute(sqladd1)
'end if


%>

<tr>
     <td valign="top" bgcolor="#FFFFFF" align="center">
    <b>New Product :<U> <% response.write pid %></U>Has Been Succesfully Entered By Administrator : <% response.write username %></b>

<%
end if

'rs.Close

'Set rs=Nothing

set objconn=nothing

 %>

    </td>
   </tr>

</td></tr></table>











 
Old March 31st, 2004, 10:23 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default

What kind of errors are you getting?

I noticed that you are using p_title to hold Request.Form("interest6") instead of interest6. Then you used p_title in your select statement. If I am not mistaken p_title will have a numeric value since you assigned it Request.Form("interest6"). Is this what you intended for your query? Were you intending to use ptitle instead of p_title in your select statement?

------------------------------------------
dim interest6
p_title = trim(Request.Form("interest6"))
response.write interest6
------------------------------------------






Similar Threads
Thread Thread Starter Forum Replies Last Post
plz.....plz solve out my problem.... kethireddy435 ASP.NET 1.x and 2.0 Application Design 1 October 4th, 2007 12:56 PM
plz solve my problem mkazim85 SQL Language 2 May 14th, 2007 05:31 AM
Hi,plz solve my problem SachinMalge ASP.NET 1.0 and 1.1 Professional 1 December 26th, 2006 06:39 AM
Very urgent(plz solve) jagathucsc BOOK: Professional Crystal Reports for VS.NET 0 August 22nd, 2006 02:44 AM
Solve my prob? plz.......... mkmaurya_it General .NET 0 February 12th, 2005 03:50 AM





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