469,904 Members | 2,482 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,904 developers. It's quick & easy.

update particular record

subashini Thiyagarajan
<%
Dim adoCon
Dim rsDeleteEntry
Dim strSQL
Dim lngRecordNo

lngRecordNo = CLng(Request.QueryString("ID"))
lngRecordNo1 = CLng(Request.QueryString("ID"))


If Request.Form("Submit") = "Submit" Then
docket = Request.Form("docket")
name1 = Request.Form("name")
fault=Request.Form("fault")
status1 = Request.Form("status")
remarks = Request.Form("remarks")
Valid = True

If status1 = "" Then
Msg1 = " Field required."
Valid = False
End If
'-- Check ItemNumber for 4 trailing digits
'If Not IsNumeric(docket) Then
' Msg1 = " Invalid format. Use '99999'."
' Valid = False
' End If



if Valid = "True" then
Set CNObj = Server.CreateObject("ADODB.Connection")
CNObj.Open "DBQ=C:\Inetpub\wwwroot\manage\ivr.mdb;DRIVER=Micr osoft Access Driver (*.mdb)"
Set RSAdd = Server.CreateObject("ADODB.Recordset")
SQL = "insert into Itemworkorder(name,fault,status,remarks) values('" & name1 &"','"& fault &"','" & status1 & "','"& remarks & SQL= SQL & "') WHERE docket1=" & lngRecordNo
RSAdd.execute

' RSAdd.AddNew

'RSAdd.Fields("docket") = docket
'RSAdd.Fields("name") = name1
'RSAdd.Fields("fault") = fault
'RSAdd.Fields("status")=status1
'RSAdd.Fields("remarks") = remarks
'RSAdd.Update

Msg="deleted" & docket1 & "in table"

RSAdd.Close
CNObj.close


End If
End If



%>



<html>
<BODY>

<center>
<h2> Call Closing Form </h2>
<p><a href="displayworkorder.asp">Back to track </a></p>
</center>




<!-- Begin form code -->
<form name="form" method="post" action="closeclose.asp">
<center> <table width="583" border="0">
<tr> <td width="220"><div align="left"><strong>Select Docket no:</strong></div></td>
<td width="318">
<input type="text" name="docket" VALUE="<%=lngRecordNo%>" > <%=Msg1%> </td></tr>
<tr> <td><p align="left"><strong>Select Your Name</strong>:</p>
</td>
<td>

<input type="text" name="name"> </td>
</tr>

<tr> <td width="220" height="30"><div align="left"><b> Actual Fault : </b></div></td>
<td width="318"><label>
<textarea name="fault" cols="50" rows="3" wrap="virtual"></textarea>
</label></td>
</tr>
<tr colspan=2>
<td><div align="left"><strong>Status : </strong></div></td>
<td><label></label>
<label>
<input name="status" type="radio" value="closed">
closed </label>
<label>
<input name="status" type="radio" value="pending">
pending</label></td>
</tr>
<tr>
<td><div align="left"><strong>If any Remarks: </strong></div></td>
<td><label>

<textarea name="remarks" cols="50" rows="3"></textarea>
</label></td>
</tr>
</table>
<br>
<input type="Submit" name="Submit" value="Submit"><br>
<%=Msg%>
</center>
</form>


</body>
</html>
Expand|Select|Wrap|Line Numbers
  1. closecall




I am receiving a docket no from the previous form ,now I am going to update values into the particular record .

What is the problem in my code??????????????????
Dec 17 '06 #1
3 1757
sashi
1,754 Expert 1GB
<%
Dim adoCon
Dim rsDeleteEntry
Dim strSQL
Dim lngRecordNo

lngRecordNo = CLng(Request.QueryString("ID"))
lngRecordNo1 = CLng(Request.QueryString("ID"))

If Request.Form("Submit") = "Submit" Then
docket = Request.Form("docket")
name1 = Request.Form("name")
fault=Request.Form("fault")
status1 = Request.Form("status")
remarks = Request.Form("remarks")
Valid = True

If status1 = "" Then
Msg1 = " Field required."
Valid = False
End If
'-- Check ItemNumber for 4 trailing digits
'If Not IsNumeric(docket) Then
' Msg1 = " Invalid format. Use '99999'."
' Valid = False
' End If

if Valid = "True" then
Set CNObj = Server.CreateObject("ADODB.Connection")
CNObj.Open "DBQ=C:\Inetpub\wwwroot\manage\ivr.mdb;DRIVER=Micr osoft Access Driver (*.mdb)"
Set RSAdd = Server.CreateObject("ADODB.Recordset")
SQL = "insert into Itemworkorder(name,fault,status,remarks) values('" & name1 &"','"& fault &"','" & status1 & "','"& remarks & SQL= SQL & "') WHERE docket1=" & lngRecordNo
RSAdd.execute

' RSAdd.AddNew

'RSAdd.Fields("docket") = docket
'RSAdd.Fields("name") = name1
'RSAdd.Fields("fault") = fault
'RSAdd.Fields("status")=status1
'RSAdd.Fields("remarks") = remarks
'RSAdd.Update

Msg="deleted" & docket1 & "in table"

RSAdd.Close
CNObj.close
End If
End If
%>

<html>
<BODY>

<center>
<h2> Call Closing Form </h2>
<p><a href="displayworkorder.asp">Back to track </a></p>
</center>




<!-- Begin form code -->
<form name="form" method="post" action="closeclose.asp">
<center> <table width="583" border="0">
<tr> <td width="220"><div align="left"><strong>Select Docket no:</strong></div></td>
<td width="318">
<input type="text" name="docket" VALUE="<%=lngRecordNo%>" > <%=Msg1%> </td></tr>
<tr> <td><p align="left"><strong>Select Your Name</strong>:</p>
</td>
<td>

<input type="text" name="name"> </td>
</tr>

<tr> <td width="220" height="30"><div align="left"><b> Actual Fault : </b></div></td>
<td width="318"><label>
<textarea name="fault" cols="50" rows="3" wrap="virtual"></textarea>
</label></td>
</tr>
<tr colspan=2>
<td><div align="left"><strong>Status : </strong></div></td>
<td><label></label>
<label>
<input name="status" type="radio" value="closed">
closed </label>
<label>
<input name="status" type="radio" value="pending">
pending</label></td>
</tr>
<tr>
<td><div align="left"><strong>If any Remarks: </strong></div></td>
<td><label>

<textarea name="remarks" cols="50" rows="3"></textarea>
</label></td>
</tr>
</table>
<br>
<input type="Submit" name="Submit" value="Submit"><br>
<%=Msg%>
</center>
</form>
</body>
</html>
Expand|Select|Wrap|Line Numbers
  1. closecall
I am receiving a docket no from the previous form ,now I am going to update values into the particular record .

What is the problem in my code??????????????????
Hi there,

Kindly refer to below sample code segment on updating data, hope it helps. Good luck & Take care.

Expand|Select|Wrap|Line Numbers
  1.   .. open db connection here..
  2.   .. create your recordset object here ..
  3.  
  4.   If rsAdd.RecordCount > 0 Then
  5.     abc = rsAdd("field1")
  6.     def  = rsAdd("field2")
  7.   End If
  8.  
  9.       rsAdd.Update
  10.       rsAdd.Close
  11.  
  12.     Set rsAdd = Nothing
  13.     Set CNObj = Nothing    
  14.  
Dec 18 '06 #2
i tried with your code.it does n't suit..

u are again retriving the table content and asking me to store it in variable.then what to do dear?



ok...........


but i tried,, what i have done , i have taken one hidden field and store it in a variable and i called it using querystring and using insert statement i saved again all the fields worked fine......


thank you so much for your replyyyyyyyyyyyys.hope i have not given right explanation about my query...
Dec 19 '06 #3
sashi
1,754 Expert 1GB
i tried with your code.it does n't suit..

u are again retriving the table content and asking me to store it in variable.then what to do dear?



ok...........


but i tried,, what i have done , i have taken one hidden field and store it in a variable and i called it using querystring and using insert statement i saved again all the fields worked fine......


thank you so much for your replyyyyyyyyyyyys.hope i have not given right explanation about my query...
Hi there,

Congrats on your little discovery :) Good luck & Take care.
Dec 19 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Jan van Veldhuizen | last post: by
9 posts views Thread by Dom Boyce | last post: by
6 posts views Thread by dd_bdlm | last post: by
reply views Thread by Mark | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.