Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

connecting database

Posted on 1999-07-31
4
Medium Priority
?
140 Views
Last Modified: 2010-04-09
I have few field with names, address, city, etc..
I want this to be stored in my database. How should I do that without using ASP and with ASP both ?
0
Comment
Question by:SGayathri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Author Comment

by:SGayathri
ID: 1852604
Can I have SQL Database or Access Database ?
0
 

Expert Comment

by:awais
ID: 1852605
I'm an ASP expert and your question has a LONG answer if you're looking for code; and you're only offering 10 points for it.  You can use Access or SQL Server; doesn't really make a big difference.  Well, you probably can't achieve this without using ASP or some CGI, so forget part I of your question.

Advice: Increase the points, maybe someone will answer.
0
 
LVL 11

Accepted Solution

by:
mouatts earned 40 total points
ID: 1852606
Funny I would have thought that an Expert _knew_ it couldn't be achieved withou ASP or CGI :)

For the following code to work you will need to set up an ODBC DSN called mydsn that points to your database.

The ASP (page1.asp) would be to display a record
<%
FUNCTION CHECKRS(RS)
      On Error Resume Next
      bEOF = RS.EOF
      If Err Or bEOF Then
            CheckRS = False
      Else
            CheckRS = True
      End If
END FUNCTION

Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open "DSN=mydsn"
sql="SELECT * FROM MYTABLE WHERE SURNAME='MOUATT'"
set res=connection.execute(sql)
%>
<HTML><BODY>
<%WHILE CHECKRS(res)%>
<FORM METHOD="POST" ACTION="page2.asp">
<INPUT TYPE="HIDDEN" NAME="ID">
<INPUT TYPE="TEXT" NAME="FIRST_NAME" VALUE="<%=res("first_name")%>"><INPUT TYPE="TEXT" NAME="SURNAME" VALUE="<%=res("surname")%>"><INPUT TYPE="SUBMIT" VALUE="Update"></FORM>
<%
    res.movenext
WEND%>
</BODY></HTML>

Now page2.asp would look like this

<%
Connection.Open "DSN=mydsn"
sql="UPDATE MYTABLE SET SURNAME='"&request("surname")&"',FIRST_NAME='"&request("first_name")&"' WHERE ID="&request("id")
connection.execute(sql)
response.redirect("page1.asp")
%>


HTH
Steve
0
 
LVL 1

Expert Comment

by:kodiakbear
ID: 6814435
Fixed the -1 problem on this question.
Escrow points corrected.

kb
Community Support Moderator
Experts Exchange
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

662 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question