473,378 Members | 1,364 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

ASP Database Help

Hi all,
I need some help on this one:
I have a webpage with a form. This form submits data that goes to a mdb file
(id (AutoNumber), name, email contry etc.). I would like to make another
page where I can type the ID number and it will show all the fields only for
that id.
I hope I've been clear enough...
Thanks a lot for you help.

Massa
Jul 19 '05 #1
12 2567
On Mon, 1 Dec 2003 21:37:23 -0200, "Massa" <ma*****@ig.com.br> wrote:
Hi all,
I need some help on this one:
I have a webpage with a form. This form submits data that goes to a mdb file
(id (AutoNumber), name, email contry etc.). I would like to make another
page where I can type the ID number and it will show all the fields only for
that id.
I hope I've been clear enough...
Thanks a lot for you help.


Very clear... where do you need help? Give some specific areas. I
assume since you can save the data, you can make a data connection,
etc.
Jul 19 '05 #2
I assume you are successfully saving the data.

Dim sSQL
Dim oRS
Dim lngID
lngID=Request.Form("theID") 'I assume you have a form that submits the id
number

sSQL="SELECT columnName1, columnName2 FROM tableName WHERE primaryIDField="
& lngID

Set oRS=validConnectionObject.Execute(sSQL)
if not oRS.EOF then
Response.write "<table><tr><th>Column1</th><th>Column2</th></tr>" &
vbCrLf
Do While not oRS.EOF
Response.Write "<tr><td>" & oRS.Fields("columnName1") & "</td><td>"
& oRS.Fields("columnName2") & "</td></tr>" & vbCrLf

RS.MoveNext
Loop
Response.Write "</table>" & vbCrLf
end if
Set oRS=Nothing

"Massa" <ma*****@ig.com.br> wrote in message
news:10***************@gorgo.centroin.com.br...
Hi all,
I need some help on this one:
I have a webpage with a form. This form submits data that goes to a mdb file (id (AutoNumber), name, email contry etc.). I would like to make another
page where I can type the ID number and it will show all the fields only for that id.
I hope I've been clear enough...
Thanks a lot for you help.

Massa

Jul 19 '05 #3
I can't figure out how to make this page where I type the ID number (with a
ok button).
Thanks
Massa
"Dan Brussee" <db******@nc.rr.com> wrote in message
news:pe********************************@4ax.com...
On Mon, 1 Dec 2003 21:37:23 -0200, "Massa" <ma*****@ig.com.br> wrote:
Hi all,
I need some help on this one:
I have a webpage with a form. This form submits data that goes to a mdb file(id (AutoNumber), name, email contry etc.). I would like to make another
page where I can type the ID number and it will show all the fields only forthat id.
I hope I've been clear enough...
Thanks a lot for you help.


Very clear... where do you need help? Give some specific areas. I
assume since you can save the data, you can make a data connection,
etc.

Jul 19 '05 #4
I am sorry for this newbie question... but where do I past this?

Dim sSQL
Dim oRS
Dim lngID
lngID=Request.Form("theID") 'I assume you have a form that submits the
id
number

sSQL="SELECT columnName1, columnName2 FROM tableName WHERE
primaryIDField="
& lngID

Set oRS=validConnectionObject.Execute(sSQL)
if not oRS.EOF then
Response.write "<table><tr><th>Column1</th><th>Column2</th></tr>" &
vbCrLf
Do While not oRS.EOF
Response.Write "<tr><td>" & oRS.Fields("columnName1") & "</td><td>"
& oRS.Fields("columnName2") & "</td></tr>" & vbCrLf

RS.MoveNext
Loop
Response.Write "</table>" & vbCrLf
end if
Set oRS=Nothing
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #5
Hi,

Create a pgae with a textbox and a submit button. Then request the id into a varibale and then file an sql statement using the where clause on the ASP page and then get the data. Like

<%
Dim id, objRs

id = Trim(Request.Form("id"))

sql = "select * from table_name where id = "&id&""

Set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open sql, objConn
while not objrs.EOF
Resoponse.Write objRs("name")
.....blah blah
objrs.MoveNext
Wend

%>
Regards,
Bhaskardeep Khaund
Jul 19 '05 #6
On Mon, 1 Dec 2003 22:37:41 -0200, "Massa" <ma*****@ig.com.br> wrote:
I can't figure out how to make this page where I type the ID number (with a
ok button).
A form, with a text entry box and a submit button. In your ASP that
processes that form, do a SELECT with that ID in the WHERE clause.

This is actually pretty basic, but I'd prefer not to write it
completely for you and have you figure it out so you'll learn it. It
may look something like this:

Form:
================
<html>
<head><title>Show Record</title></head>
<body>
<P><form action="ShowRecord.asp">
Show Record Number: <input type="text" size="8" name="RecordID"><BR>
<input type="submit" name="Submit" value="Show Record">
</form></P>
</body></html>
ShowRecord.asp:
=================

' Get the record ID from form
RecordID = Request.Form("RecordID")

' create the actual SQL statement to do what you ask
SQLStmt = "SELECT * FROM tblTable WHERE RecordID =" & RecordID

' Create the database connection
dbConnect = (Put your connection string here)
Set db = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
db.Open dbConnect

' Run the Query
Set rs = db.Execute(SQLstmt)

' Now display the query results in whatever format you wish...
There are plenty of ways to modify this, but the basics are here.
It's sloppy and there are better methods you'll want to learn for this
type of request, you might check some of these links for suggestions
and tutorials:

http://www.sqlcourse.com/
http://www.learnasp.com/learnasp/ (Database section to start)
http://www.aspfaq.com/show.asp?id=2424
http://www.tutorial-web.com/asp/database/
http://www.asp-help.com/database/db_tutorial1.asp

And Google for more... :)

Jeff

"Dan Brussee" <db******@nc.rr.com> wrote in message
news:pe********************************@4ax.com.. .
On Mon, 1 Dec 2003 21:37:23 -0200, "Massa" <ma*****@ig.com.br> wrote:
>Hi all,
>I need some help on this one:
>I have a webpage with a form. This form submits data that goes to a mdbfile >(id (AutoNumber), name, email contry etc.). I would like to make another
>page where I can type the ID number and it will show all the fields onlyfor >that id.
>I hope I've been clear enough...
>Thanks a lot for you help.
>


Very clear... where do you need help? Give some specific areas. I
assume since you can save the data, you can make a data connection,
etc.


Jul 19 '05 #7
Like this?
Thanks for your help

Massa

<html>
<head>
<title>TEST</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body><form action="" method="get" >
ID
<input type="text" name="textfield">
<input type="submit" name="Submit" value="Submit">
<%
Dim id, objRs

id = Trim(Request.Form("id"))

sql = "select * from table_name where id = "&id&""

Set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open sql, objConn
while not objrs.EOF
Resoponse.Write objRs("name")
.....blah blah
objrs.MoveNext
Wend

%>

</form>

</body>
</html>

"Bhaskardeep Khaund" <bh*********@hotmail.com> wrote in message news:ey**************@TK2MSFTNGP10.phx.gbl...
Hi,

Create a pgae with a textbox and a submit button. Then request the id into a varibale and then file an sql statement using the where clause on the ASP page and then get the data. Like

<%
Dim id, objRs

id = Trim(Request.Form("id"))

sql = "select * from table_name where id = "&id&""

Set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open sql, objConn
while not objrs.EOF
Resoponse.Write objRs("name")
.....blah blah
objrs.MoveNext
Wend

%>
Regards,
Bhaskardeep Khaund
Jul 19 '05 #8
-----Original Message-----
Hi all,
I need some help on this one:
I have a webpage with a form. This form submits data that goes to a mdb file(id (AutoNumber), name, email contry etc.). I would like to make anotherpage where I can type the ID number and it will show all the fields only forthat id.
I hope I've been clear enough...
Thanks a lot for you help.

Massa
.

You Must Use "Sesion" Method to solve your problem.U can
find a lot of scripts if u search asp pages for session
samples so maybe then u can find it there
if i can help u i will be glad.
Jul 19 '05 #9
Hi,

No, Make two different pages...it would be easier for u...........

Page1.asp

<html>
<head>
<title>TEST</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body><form action="Page2.asp" method="post" >
ID
<input type="text" name="id">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
Page2.asp
<html>
<head><title></title></head>
<body>
<table width="80%" align="center">
<%
Dim id, objRs
id = Trim(Request.Form("id"))
sql = "select * from table_name where id = "&id&""
Set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open sql, objConn
while not objrs.EOF
%>
<tr>
<td><%=objRs("firstname")%></td>
<td><%=objRs("address")%></td>
.......
</tr>
<%objrs.MoveNext
Wend
%>
</table>
</body>
</html>
<%Set objRs = Nothing %>
Jul 19 '05 #10
Also, you didn't create a connection object.
You referred to objConn so you need to add a couple of lines

Dim objConn
Set objConn=CreateObject("ADODB.Connection")
objConn.Open "a valid connection string... refer to
www.connectionstrings.com
Then you can do your
objRS.Open sql,objConn

although I prefer

Set objRS=objConn.Execute(sql)

and of course, remember to close and release your objects
objRS.Close 'if you used the objRS.open method
objConn.Close
Set objRS=nothing
Set objConn=nothing

"Bhaskardeep Khaund" <bh*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

No, Make two different pages...it would be easier for u...........

Page1.asp

<html>
<head>
<title>TEST</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body><form action="Page2.asp" method="post" >
ID
<input type="text" name="id">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
Page2.asp
<html>
<head><title></title></head>
<body>
<table width="80%" align="center">
<%
Dim id, objRs
id = Trim(Request.Form("id"))
sql = "select * from table_name where id = "&id&""
Set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open sql, objConn
while not objrs.EOF
%>
<tr>
<td><%=objRs("firstname")%></td>
<td><%=objRs("address")%></td>
.......
</tr>
<%objrs.MoveNext
Wend
%>
</table>
</body>
</html>
<%Set objRs = Nothing %>
Jul 19 '05 #11
Hi,

Ya i know that...i wote 'Set your Connection Object'.....and i guess anybody can do that...i dont need to write....
Bhaskardeep Khaund
Jul 19 '05 #12
Sorry, I meant to reply to Massa's post, not yours.

"Bhaskardeep Khaund" <bh*********@hotmail.com> wrote in message
news:un**************@TK2MSFTNGP12.phx.gbl...
Hi,

Ya i know that...i wote 'Set your Connection Object'.....and i guess anybody
can do that...i dont need to write....
Bhaskardeep Khaund
Jul 19 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Marvin Libson | last post by:
Hi All: I am running DB2 UDB V7.2 with FP11. Platform is Windows 2000. I have created a java UDF and trigger. When I update my database I get the following error: SQL1224N A database...
0
by: Alex | last post by:
Hi all, I've been running a db2 V8.1 databasle to store my radius server accounting info for a *long* time and have never had any problems with it. Last week we had a power outage in our...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
18
by: surfrat_ | last post by:
Hi, I am having the following problems in getting Microsoft Visual Studio 2005 Professional to link to an Access .mdb database. Please help me to sort this out. Problem 1: The Microsoft...
12
by: grace | last post by:
i am wondering why my database retrieval becomes too slow...we set up a new server (ubuntu, breezy badger) machine where we transferred all our files from the old server.. Our new server uses Asus...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.