|
| |
|
|
wizard_oz
Posts: 145 Joined: 9/3/2004 From: Ga,USA Status: offline
|
Transfer Some data to a database - 9/28/2006 7:24:41
Hi, I created a page whcih send to DATA the code is:(only part of the code) <FORM action="EditPriority.asp" method=POST id=form1 name=form1>
<%
Response.Write "<td><INPUT type=""text"" id=""IdRight"" name=""IdRight"" size=5 value=" & rs("ID") & "></td>"
Response.Write "<td><INPUT type=""text""' id=""Priority"" name=""Priority"" size=1 value=" & rs("Priority") & "></td>"
rs.MoveNext
wend
At the other page I am trying to UPDATE me records:
<%
IdRight=Request.Form("IdRight")
set conn=server.CreateObject("ADODB.connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\WebSite\MagenLi\magenli.mdb"
If Len(Request.Form("Priority")) = 0 Then
Response.Write "You haven't selected any software, that makes me sad :("
Else
Response.Write "You have selected the following software: <br />"
Dim t_soft
For each t_soft in Request.Form("Priority")
For each t_id in Request.Form("IdRight")
conn.Execute "UPDATE RightMenu SET Priority='" & t_soft & "' where id=" & t_id
next
Next
End If
conn.Close
set conn=nothing
%>
The code is not working fine becasue the second FOR command is wrong becasue I need to update every id's record and this code updates all the record with the same data I understand why it's happend, how can I move the next id without the for command?
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Transfer Some data to a database - 9/28/2006 9:10:25
quote:
conn.Execute "UPDATE RightMenu SET Priority='" & t_soft & "' where id=" & t_id Just before that line try putting these two lines: Response.write("UPDATE RightMenu SET Priority='" & t_soft & "' where id=" & t_id) Response.end That should write the full SQL to the screen so you can see anything there. Also, you have what looks like a typo in there (see the apostrophe?) Response.Write "<td><INPUT type=""text""' id=""Priority"" name=""Priority
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
wizard_oz
Posts: 145 Joined: 9/3/2004 From: Ga,USA Status: offline
|
RE: Transfer Some data to a database - 9/28/2006 11:50:34
How is thise lines that you wrote will help me? I know what's the problem. the problem is I have 2 loops and I don't need them, I need the extranal loop and then every priority i need to match it to a certain record
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Transfer Some data to a database - 9/28/2006 12:39:31
quote:
How is thise lines that you wrote will help me? Sorry. Just trying to figure out what the problem is. I'm not sitting in your seat. You posted incomplete code with bad syntax in your first section and I just wanted to confirm step A was working correctly before step B. But anyways....I guess I dunno' then... Did you fix your typos?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
wizard_oz
Posts: 145 Joined: 9/3/2004 From: Ga,USA Status: offline
|
RE: Transfer Some data to a database - 9/28/2006 12:45:36
First thanks for your help. I tryied your code and it gave me what i thought , It gave me the selection of a certain record and that it what I need is to find how do I update my records for example I have 4 records and I would like to update the first recocrd, and me data for that record is: priority 1 and id=1 now the second record is priority 3 and id=2 and the third record is priority 2 and id=3 this way I can sort my data is this help you to understand my problem?
|
|
|
|
wizard_oz
Posts: 145 Joined: 9/3/2004 From: Ga,USA Status: offline
|
RE: Transfer Some data to a database - 9/29/2006 11:28:16
anyone??????????
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Transfer Some data to a database - 9/29/2006 11:41:27
quote:
conn.Execute "UPDATE RightMenu SET Priority='" & t_soft & "' where id=" & t_id So instead of that line, what if you put this line in there temporarrily: response.write ("UPDATE RightMenu SET Priority='" & t_soft & "' where id=" & t_id & "<br>") That would output all your SQL statements to the screen and that might give you hints. My biggest recommendation is to don't overlook 'response.write' especially when it comes to lopping thru SQL statements and such. You absolutely need to confirm you're using the proper SQL and the right values. IMO that is invaluable in determining which way to turn. PS. None of us get paid anything on this forum - we're all volunteers. So I try to get you to do some of the work. I usually try to nudge you in a certain direction and not do the work for you. It's that whole 'teach a person to fish' thing. Hope that helps.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
wizard_oz
Posts: 145 Joined: 9/3/2004 From: Ga,USA Status: offline
|
RE: Transfer Some data to a database - 9/30/2006 5:25:29
Hi Again, thanks for your help and I'm sorry if I sounds rude, that wasn't my intention. I just didn't know how to explain my problem I mean I tried almost everythinh before I contact you.usually I'm working hard to do it by my self and only if a have a serious problem for me I am contact you Again Sorry and thank you for you help I will try to do it Elen
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|