944,028 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 4210
  • ASP RSS
Sep 29th, 2004
0

Very new to ASP

Expand Post »
Hi,

I am very very new to ASP. So far i have been able to connect to the SQL database using dreamweaver mx 2004 but im not sure where to go from here.

I have a support databse that i have setup with a few records.
The table structure looks something like this

Client
-ClientID
-Client
-Address
-PhoneNumber

How do i go about showing the list of clients on the ASP page?

Any help or links would be GREAT :c) im stuck and i cant seem to find anything at all!!!

cheers,
Orion
Reputation Points: 10
Solved Threads: 0
Newbie Poster
orionm is offline Offline
3 posts
since Sep 2004
Sep 29th, 2004
0

Re: Very new to ASP

A couple of really good places to start are www.w3schools.com, www.4guysfromrolla.com, www.asp101.com

There are heaps of tutorials and sample scripts out there. Have a search around, try some out and if you get stuck hit the forums and ask away.:cheesy:

Good luck
Reputation Points: 16
Solved Threads: 7
Junior Poster
Lafinboy is offline Offline
166 posts
since Jul 2004
Sep 29th, 2004
0

Re: Very new to ASP

ok - well i have now spent a day on this, no luck. I have been to all those sites as well and i just cant get it

Basically i want to pull basic info from my SQL DB and display it on the ASP page. I have tried so many things but all i get is errors. Lately i have actually resolved the errors but nothing is written to the screen!!

Arghh this is driving me nuts.

Can anyone tell me how to write up the results from a SQL BD to a plain ASP file?

I have the DB connection done and its working.

Cheers,
Orion
Reputation Points: 10
Solved Threads: 0
Newbie Poster
orionm is offline Offline
3 posts
since Sep 2004
Sep 29th, 2004
0

Re: Very new to ASP

It's going to be easier to help you if you can post the code you are trying and we can work through that and fix whatever problems there may be.
Reputation Points: 16
Solved Threads: 7
Junior Poster
Lafinboy is offline Offline
166 posts
since Jul 2004
Sep 29th, 2004
0

Re: Very new to ASP

orionm>

There are tones of tutorials on google about stuff like this. For now here is the answer you were looking for.

ASP Syntax (Toggle Plain Text)
  1. 'After you open your connection
  2. SQL = "SELECT * FROM Client"
  3. Set rsMaster = objConnection.Execute(SQL)
  4.  
  5. If rsMaster.EOF = False Then
  6. Do Until rsMaster.EOF
  7. 'To make it easier on your self you should make your primary key ID instead of ClientID
  8. Response.Write("Client ID: " & rsMaster("ClientID") & "<br>")
  9. Response.Write("Client: " & rsMaster("Client") & "<br>")
  10. Response.Write("Address: " & rsMaster("Address") & "<br>")
  11. Response.Write("Phone Number: " & rsMaster("PhoneNumber") & "<br>")
  12. Response.Write("<hr>")
  13. rsMaster.MoveNext
  14. Else
  15. Response.Write("No records in table")
  16. End If
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Cyber-SEO is offline Offline
10 posts
since Sep 2004
Sep 29th, 2004
0

Re: Very new to ASP

Hahaha *crazy laugh* - ok ive tired that code and no luck.

I must be doing something wrong.

The error reads

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/newcall.asp, line 111


Line 111 being "Set rsMaster = objConnection.Execute(SQL)"

Does this mean i have not set my connection properly?

for the connection i have the collowing code

ASP Syntax (Toggle Plain Text)
  1. <%@LANGUAGE="VBSCRIPT"%>
  2. <!--#include file="Connections/support.asp" -->
  3. <%
  4. Dim Client
  5. Dim Client_numRows
  6.  
  7. Set Client = Server.CreateObject("ADODB.Recordset")
  8. Client.ActiveConnection = MM_Support_STRING
  9. Client.Source = "SELECT * FROM dbo.Client"
  10. Client.CursorType = 0
  11. Client.CursorLocation = 2
  12. Client.LockType = 1
  13. Client.Open()
  14.  
  15. Client_numRows = 0
  16. %>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
orionm is offline Offline
3 posts
since Sep 2004
Oct 2nd, 2004
0

Re: Very new to ASP

Quote originally posted by orionm ...
Hi,

I am very very new to ASP. So far i have been able to connect to the SQL database using dreamweaver mx 2004 but im not sure where to go from here.

I have a support databse that i have setup with a few records.
The table structure looks something like this

Client
-ClientID
-Client
-Address
-PhoneNumber

How do i go about showing the list of clients on the ASP page?

Any help or links would be GREAT :c) im stuck and i cant seem to find anything at all!!!

cheers,
Orion
On your asp page you will need to connect to your db some way. Example:
oConn.Open "Driver={SQL Server};" & _
"Server=MyServerName;" & _
"Database=myDatabaseName;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
then you will need your SELECT statement:

SELECT ClientID,Client, Address, City FROM Clients

*Check out this tutorial
http://www.w3schools.com/ado/default.asp

then use <%Response.write("Client")%>

this is a very incomplete simple example. I am new too. Hope it helps
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vree is offline Offline
2 posts
since Sep 2004
Feb 21st, 2005
0

Re: Very new to ASP

There are great ASP Tutorials at Web Wiz Guide which can always be of help also.

Web Wiz Guide : http://www.webwizguide.info/asp/tutorials/default.asp
Reputation Points: 10
Solved Threads: 0
Light Poster
VSBrown is offline Offline
34 posts
since Feb 2005
Feb 26th, 2005
0

Re: Very new to ASP

I know this connection is generated from Dreamweaver UltraDev or MX.
Do you know how to use the repeat region in UltraDev or MX? It's fairly easy.

Here is my sample, no response.write use to confuse non programmers.
<%
Dim Client
Dim Client_numRows

Set Client = Server.CreateObject("ADODB.Recordset")
Client.ActiveConnection = MM_Support_STRING
Client.Source = "SELECT * FROM Client" ' assume your table name is Client
Client.CursorType = 0
Client.CursorLocation = 2
Client.LockType = 1
Client.Open()
Client_numRows = 0
%>

<%
Dim Repeat2__numRows
Repeat2__numRows = 10 ' Display how many records. In this sample we set 10 records
Dim Repeat2__index
Repeat2__index = 0
Client_numRows = Client_numRows + Repeat2__numRows
%>

<html>
<head>
<title>Test</title>
<body>
<table>
<tr>
<td>
' All records are display inside one table. If you want alternate color for each cell, you need to create another table and put the "While ((Repeat2__numRows <> 0) AND (NOT Client.EOF)) " outside the table.

<%
While ((Repeat2__numRows <> 0) AND (NOT Client.EOF))
%>
Client ID: <%=Client("ClientID")%><br>
Client: <%=Client("Client")%<br>
Address: <%=Client("Address")%><br>
Phone Number: <%=Client("PhoneNumber")%><br>
<hr>
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
Client.MoveNext()
Wend
%>
</td>
</tr>
</table>

<%If Client.EOF Then%>
No records in table
<%
End If
%>
<%
Client.Close ' Close connection
Set Client = Nothing ' Kill and free up memory
%>
</body>
</html>

www.ex-designz.net
Dexter
Reputation Points: 10
Solved Threads: 3
Junior Poster in Training
dexterz is offline Offline
86 posts
since Feb 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: Run ASP scripts on Win XP Home
Next Thread in ASP Forum Timeline: Windows 2000 server not allowing ASP access.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC