Search the web
Sign In
New User? Sign Up
asp-FAQ · Active Server Pages - FAQ
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
How to Add New Record using ASP (Answer Plz)   Message List  
Reply | Forward Message #19 of 19 | Next >
Re: [asp-FAQ] How to Add New Record using ASP (Answer Plz)


Syed,

I will take a stab at this, although I think I would need to see more code to be
of more help.

1 - Change your form method to "post":

<form name="form1" action="ThisPage.asp" method="post">
<input type="hidden" name="IsSubmitted">
<input type="text" name="Text1">
<input type="text" name="Text2">
<input type="text" name="Text3">
<input type="submit">
</form>

2 - Change your code at the top of this page to:

<%

If Request.Form("IsSubmitted") Then
'The page was submitted. Continue

Dim strText1, strText2, strText3
Dim oConn, oRS, sSQL

'Get our values into variables.
strText1 = Request.Form("Text1")
strText2 = Request.Form("Text2")
strText3 = Request.Form("Text3")

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("abc.mdb"))
sSQL= "INSERT INTO Info (Field1, Field2, Field3) VALUES ('" & strText1 & "','"
& strText2 & "','" & strText3 & "')"
Set oRS = oConn.Execute(sSQL)
oConn.Close
Set oRS = Nothing
Set oConn = Nothing

End If

%>

*** This is untested, I am typing it directly into this email. ***

3) Send us a more specific error. Assuming your using Internet Explorer, go to:
Tools --> Internet Options --> Advanced --> Uncheck 'Show Friendly HTTP Error
Messages'.

If you continue to have problems, post the technical error.

HTH,
Mark


syed hassan <lorany21k@...> wrote:


Dear Memebers

I am new to ASP I have to build Admin Page using ASP which must be capable of
Add,Delete,Update a Record

My Question are

1. In order to Add a record How can I get Values from field i.e. I have three
Text Boxes named text1,text2,text3 respectively two buttons 1 for Submit and
other for Reset

Form Actio is "Get"

I am using following Qury

I am just writing ASP code It must be noted that all the fields in Table are
Text Type

<%
Response.Expires = -1000
Dim oConn
Dim oRS
Dim sSQL
Dim sColor
Dim GetVal
If Category<>"" Then
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("abc.mdb"))
sSQL= "INSERT INTO Info VALUES ('" & text1 & "','" & text2 & "','" & text3 &
"')"
Set oRS = oConn.Execute(sSQL)
oConn.Close
Set oRS = Nothing
Set oConn = Nothing
end if
%>
i have also tryied

sSQL= "INSERT INTO info VALUES ('p','p','d')
but I am getting HTTP error what is wrong with this Query ?

when I use Query to retrive Data it works fine but whenever I try to perform
Add,Delete,Update operations I get HTTP error

Plz help me to solve this Problem

Thanks in Advance

Munawer






---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.

[Non-text portions of this message have been removed]






'===========================================================
Archive : http://ReliableAnswers.com/YG/msg?asp-faq
Files : http://ReliableAnswers.com/YG/files?asp-faq
Group : http://ReliableAnswers.com/YG/group?asp-faq
Subscribe : http://ReliableAnswers.com/YG/sub?asp-faq
Unsubscribe : http://ReliableAnswers.com/YG/unsub?asp-faq
Attachments : Not Permitted
'===========================================================



Yahoo! Groups SponsorADVERTISEMENT


---------------------------------
Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/asp-FAQ/

To unsubscribe from this group, send an email to:
asp-FAQ-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



[Non-text portions of this message have been removed]







Mon Oct 18, 2004 9:22 pm

meckeard2000
Offline Offline
Send Email Send Email

Forward
Message #19 of 19 | Next >
Expand Messages Author Sort by Date

Dear Memebers I am new to ASP I have to build Admin Page using ASP which must be capable of Add,Delete,Update a Record My Question are 1. In order to Add a...
syed hassan
lorany21k
Offline Send Email
Oct 17, 2004
7:02 pm

Syed, I will take a stab at this, although I think I would need to see more code to be of more help. 1 - Change your form method to "post": <form name="form1"...
Mark E
meckeard2000
Offline Send Email
Oct 18, 2004
9:39 pm
< Prev Topic  |  Next Topic >
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help