Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > Classic ASP

Reply
 
LinkBack Thread Tools
Old October 21st, 2009, 02:38 AM   #1
New Member
 

Join Date: Oct 2009
Location: karachi
Age: 19
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 devilpace is on a distinguished road
Arrow value not passing when editing the database grid

Basically I hv to update the database table.. by clicking the hyperlink textboxes should appear n on tht we edit n then update the table.... when i m clicking the hyperlink textboxes are coming but in that the values of databases are not coming.. plz help quick response will be appreciated. here is my code

<%@ LANGUAGE=VBSCRIPT %>
<!-- #INCLUDE FILE="include/Connection.asp" -->



<script language="javascript">

function up(row)
{

document.getElementById('tbl').rows[row].innerHTML=document.getElementById('tblup').rows[0].innerHTML;

}

function dosubmit(itm){
frmInfo.opr.value = itm
frmInfo.submit();
}

function getID(itm, str){
frmInfo.msno.value = itm

dosubmit(str);
}
</script>

<%

dim rs

response.write(request.form)
response.write(request.querystring)

opr = request.form("opr")

if isempty(request.form("opr")) = true then
opr = "list"
end if


%>




<form name="frmInfo" method="post">



<!-- ...........................................Save Update............................................ ....... -->
<%
if opr = "saveupdate" then


Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "Select * from Info where sno = " & request.form("txtSno1"), strConn, 1, 3


'rs.fields("sno") = request.form("txtSno")
rs.fields("sname") = request.form("txtSname1")
rs.fields("address") = request.form("txtAddress1")
rs.update

'opr = "list"
response.redirect("assignment.asp")
%>

<!-- ...........................................Save Update............................................ ....... -->

<%end if%>



<!-- ...........................................Delete. .................................................. -->
<%
if opr = "delete" then


set sno = request.form("sno")

dim str

for cnt = 1 to sno.count
str = str & sno(cnt)&", "
next
str = left(str, len(str)-2)

'response.write(str)
'response.write("Delete from Info Where sno IN(" & str & ")")


set rs = server.createobject("ADODB.Recordset")
rs.Open "Delete from Info Where sno IN(" & str & ")", strConn, 1, 3

opr = "list"

%>

<!-- ...........................................Delete. .................................................. -->

<%end if%>

<!-- ...........................................Save... ................................................ -->
<%
if opr = "add" then


Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "Select * from Info", strConn, 1, 3

rs.AddNew
rs.fields("sno") = request.form("txtSno")
rs.fields("sname") = request.form("txtSname")
rs.fields("address") = request.form("txtAddress")
rs.update

opr = "list"

%>

<!-- ...........................................Save... ................................................ -->

<%end if%>





<!-- ...........................................List... ................................................ -->
<%
if opr = "list" then

Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "Select * from Info order by sno", strConn
'response.write(request.form("msno"))
'response.write(request.form("sno"))

%>
<table id="tbl" border="0" width="100%">
<%
dim x
x=0

While not rs.EOF
response.flush

%>

<%
'm=request.form("msno")
'response.write(m)
'mm=cint(m)
'response.write(mm)
'abc=rs.fields("sno")
'response.write(abc)
'x=cint(rs.fields("sno"))
'response.write(x)
%>
<!--
<tr>
<td>&nbsp;</td>
<td><input type="text" name="txtsno1" id="txtsno1" value="<%=rs.fields("sno")%>" readonly></td>
<td><input type="text" name="txtsname1" id="txtsname1" value="<%=rs.fields("sname")%>"></td>
<td><input type="text" name="txtaddress1" id="txtaddress1" value="<%=rs.fields("address")%>"></td>
<td><input type="button" value="update" onclick="dosubmit('saveupdate')"><td>
</tr>


-->

<tr>
<td><input type="checkbox" name="sno" value="<%=rs.fields("sno")%>"></td>
<td><%=rs.fields("sno")%></td>
<td><a href="#" onclick="up(<%=x%>)"><%=rs.fields("sname")%></a></td>
<td><%=rs.fields("address")%></td>
</tr>

<%
x=x+1
rs.MoveNext
Wend
%>



<tr>
<td><input type="button" value="Del" onclick="dosubmit('delete')"></td>
<td><input type="text" name="txtsno" id="txtsno"></td>
<td><input type="text" name="txtsname" id="txtsname"></td>
<td><input type="text" name="txtaddress" id="txtaddress"></td>
<td><input type="button" value="Add" onclick="dosubmit('add')"></td></tr>
</table>
<!-- ...........................................List... ................................................ -->



<%end if%>

<!-- ...........................................Add Form.............................................. ..... -->




<!-- ...........................................Add Form.............................................. ..... -->



<br>
<input type="hidden" name="msno" id="msno"><br>
<input type="hidden" name="opr" id="opr"><br>
<table id="tblup" width="0%">

<tr>
<td>&nbsp;</td>
<td><input type="text" name="txtsno1" id="txtsno1" value="" readonly></td>
<td><input type="text" name="txtsname1" id="txtsname1" value=""></td>
<td><input type="text" name="txtaddress1" id="txtaddress1" value=""></td>
<td><input type="button" value="update" onclick="dosubmit('saveupdate')"><td>
</tr>

<table>


</form>
devilpace is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add thead,th tags to data grid in asp.net 1.x?? omesh .NET 1 January 4th, 2009 06:37 AM
Data grid controls Alfonso Calderon .NET 5 August 5th, 2006 12:31 AM
Help designing a crossword grid... andrewsco HTML, XHTML and CSS 4 July 3rd, 2006 04:05 AM
How to create Editable Grid using DHTML satishsabapathy HTML, XHTML and CSS 3 October 20th, 2003 09:17 AM


Search Engine Optimization by vBSEO 3.2.0 RC8