Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004

    Unanswered: 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"
    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")%>">

    Set objRS = Nothing
    Set objConn = Nothing

    Any help would be greatly appreciated...

  2. #2
    Join Date
    Jun 2003
    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.


    So you might try brackets around the field names.
    J. Paul Schmidt, Freelance Web and Database Developer
    Access Database Sample, Web Database Sample, ASP Design Tips

  3. #3
    Join Date
    Dec 2003
    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 %>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts