If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Connection to Display Record in a form

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-28-04, 15:11
JimWa JimWa is offline
Registered User
 
Join Date: Jan 2004
Posts: 40
Connection to Display Record in a form

Could someone help me. THis is the code I am using to display a record from the database to a form

For some reason some of the fields in the record do not populate the text boxs and text areas.

Could it be the connections, the database setting? I am really baffled. When I open the database in Query analyzer all the data is there.

<%
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "DSN=amigos.sql.93;UID=amigos;PWD=ZZZZZZ;DATABASE= ZZZZZZ"
objConn.Open
Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM tbl_Courses where CourseID = " & request.querystring("CourseID")
objRS.Open strSQL, objConn%>

<input type="text" name="Score" size="10" value="<%=objRS("Score")%>">

<%
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>

Any help would be greatly appreciated...
Reply With Quote
  #2 (permalink)  
Old 02-03-04, 03:48
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
Here is a little note to myself which I had previously written about brackets. Don't know if this might apply to you as well somehow.

<<
Need to put brackets around and often the table name and a period before field names that contain odd characters such as spaces or have names that conflict with other things such as field names like Date, Password, Position, Quantity, or User.

Example:
MyTable.[Position]
>>

So you might try brackets around the field names.
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
  #3 (permalink)  
Old 02-03-04, 17:23
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
It is better to use If statement when you retrieve data from record set

<% If Not RS.EOF Then %>
<input type="text" name="Score" size="10" value="<%=objRS("Score")%>">
<% End If %>
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On