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!!! :confused:

cheers,
Orion

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 :?:

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.

orionm>

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

'After you open your connection
SQL = "SELECT * FROM Client"
Set rsMaster = objConnection.Execute(SQL)

If rsMaster.EOF = False Then
  Do Until rsMaster.EOF
    'To make it easier on your self you should make your primary key ID instead of ClientID
    Response.Write("Client ID: " & rsMaster("ClientID") & "<br>")
    Response.Write("Client: " & rsMaster("Client") & "<br>")
    Response.Write("Address: " & rsMaster("Address") & "<br>")
    Response.Write("Phone Number: " & rsMaster("PhoneNumber") & "<br>")
    Response.Write("<hr>")
  rsMaster.MoveNext
Else
  Response.Write("No records in table")
End If

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

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/support.asp" -->
<%
Dim Client
Dim Client_numRows

Set Client = Server.CreateObject("ADODB.Recordset")
Client.ActiveConnection = MM_Support_STRING
Client.Source = "SELECT * FROM dbo.Client"
Client.CursorType = 0
Client.CursorLocation = 2
Client.LockType = 1
Client.Open()

Client_numRows = 0
%>

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!!! :confused:

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

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

this is a very incomplete simple example. I am new too. Hope it helps

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.