www.webdeveloper.com
Results 1 to 2 of 2

Thread: Want to add data in present data in database table feild

  1. #1
    Join Date
    Jul 2008
    Posts
    29

    Want to add data in present data in database table feild

    I have a text feild area ,Notes and I am inserting its value to the database table and the redirecting back to form.

    I am displaying that notes value from database just above the textarea feild of the form.

    I want that when my user submit more notes, that value should be able to add to the present value.

    what I am able to do is update new value but not able to add to it.

    I want to display it like:

    notes.add notes.addmore notes....


    This is the code I am using for form:
    Code:
                     							
    					<%
    					if objRS2.recordcount > 0 then
    					Response.Write objRS2("Notes")
    					else
    					Response.Write ("No Notes Specified")
    					end if
    					
    					%>
    					</td>
                      </tr>
                      <tr>
                        <td height="20"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
    					
                            <tr>
                              <td width="85%" align="left" valign="middle">&nbsp;
                                  <textarea name="t1" cols="90" rows="4" wrap="OFF" class="style14" id="t1"></textarea>

    This is the page where notes values are inserting to database

    Code:
    Dim req_no, notes, Username
                    req_no = Request.QueryString("req_no")
    				Username = Request.QueryString("Username")
    				
    				notes = Request.form("t1")
    				
    				DIM objConn, sqlstr, objRS
                    Set objConn = Server.CreateObject("ADODB.Connection")
                    sConnString = ""
    				mySQL = "SELECT * FROM Notes where req_no= "& req_no & ";"
                    Set objRS = Server.CreateObject("ADODB.Recordset")
                    objRS.Open mysql, objConn,3,1
    				
    				if objRS.recordcount > 0 then
    				sSQL = "Update Notes set Notes='"&notes&"' where req_no='"&req_no&"'" 
                    else 
    				sSQL = "INSERT into Notes (req_no, Notes)values('" & req_no & "', '" & notes & "')"
    				end if
    				
    				objConn.execute(sSQL)
    				objRS.Close
                    Set objRS = Nothing
                              objConn.Close
                              Set objConn = Nothing
    				Response.Redirect("RMAdetails.asp?req_no="&req_no&"&Username="&Username)

  2. #2
    Join Date
    Mar 2006
    Posts
    591
    Are you executing the update statement before you fill your textfield?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles