Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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 16th, 2006, 02:55 PM
Registered User
 
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jdsflash Send a message via Yahoo to jdsflash
Default record add problem newbie here

New to asp and databases any help is greatly apreciated!
Im having problems adding recoreds to my database.
heres a link to my form.asp and confirm.asp
http://flexo.wisc-online.com/form.asp
http://flexo.wisc-online.com/confirm.asp

confirm asp code
Code:
<%
DIM objRS, objConn
objConn = "Driver={SQL Server}; server=myserver;Database=mydatabase; UID=myid; PWD=mypw"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "tbltest", objConn
objRS.AddNew
objRS("Email") = Request.Form("Email")
objRS("FirstName") = Request.Form("FirstName")
objRS("LastName") = Request.Form("LastName")
objRS("Comments") = Request.Form("Comments")
objRS("DateContacted") = Date()
objRS.Update
%>
<p>
<%
DIM strFirstName
strFirstName = Request.Form("FirstName")
%>,<br>
</p>
<%
objRS.Close
Set objRS = Nothing
objCONN.Close
Set objCONN = Nothing
%>
What am I doing wrong?

 
Old May 18th, 2006, 10:39 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

cross post
http://p2p.wrox.com/topic.asp?TOPIC_ID=44390

 
Old May 19th, 2006, 12:01 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

I'm not sure what the problem is here but I'll show you a little trick that you can use to find out.

Have your editor open. Fill in your form and post it. If you get a Page Cannot Be Displayed, select all of the code on your page, delete it and type a single character on the page. Refresh your page and you should see that single character. Then do a Ctrl + Z in your editor to put the code back into the page. Save it and refresh the page again. This will then give you exactly what the error is and possibly a line number.

I don't use the UPDATE method in classic asp. Here is how I would execute your code.

This code executes fine. I tried it.

Code:
<%
    DIM objRS, objConn, strConn
    strConn = "Driver={SQL Server}; server=myserver;Database=mydatabase; UID=myid; PWD=mypw"

    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open strConn

    SQL = "Insert into tbltest (Email, FirstName, LastName, Comments, DateContacted) VALUES ('" & Request("Email") & "', '" & Request("FirstName") & "', '" & Request("LastName") & "','" & Request("Comments") & "', '" & Date() & "') ;"
    Set objRS = objConn.Execute(SQL)

    objConn.Close
    Set objConn = Nothing
%>
Hope this helps.

 
Old May 19th, 2006, 12:04 PM
Registered User
 
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jdsflash Send a message via Yahoo to jdsflash
Default

That was great thanks allot!!! You guys are allot of help






Similar Threads
Thread Thread Starter Forum Replies Last Post
Add record mateenmohd Access 1 October 3rd, 2006 06:53 AM
Problem with: Add new record in GridView kalchev ASP.NET 2.0 Basics 0 April 26th, 2006 07:59 AM
how to add new record as first record in dataset [email protected] ASP.NET 1.0 and 1.1 Professional 4 April 21st, 2006 05:23 AM
Help with Add record topshed Classic ASP Basics 6 February 7th, 2006 02:59 AM
Cannot add new record geolando Access 0 June 27th, 2005 06:23 PM





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