SEARCH YOUR SOLUTION HERE  

adding to a db using a for loop help.?

i am tryin to add to a database using the code below. i wanna add some data s amount of times and a different set of data t amount of times. basically i am addin the same data for the time been a set number of times eact time any ideas thanks



add to db




Posted On: Friday 26th of October 2012 04:46:20 AM Total Views:  528
View Complete with Replies




Related Messages:

adding authentication to cdonts   (341 Views)
I have many web forms on my website using cdonts to send 2 emails per form. The first goes to whoever at our office needs the email and the second to the user saying that we will contact them shortly.Lately the website has been under attack of spammers, I can`t even open the badmail folder it is so large, I could open items in the queue folder and there is a load of rubbish in there using random from/to addresses. of these spam emails are clogging up our system, today we received emails form the site fromm before christmas.Is there a way to use authentication or something to stop the spammers using my smtpWe host the website on a seperate server just for the website with iis and smtp turned on. Our main exchange email server is on another machine
ASP Page(s) - Database Results Error - When adding drop down box   (299 Views)
I have several ASP pages on my website that do not work. Im running IIS6.0 on WIN2K3 w/sharepoint2.0Active Server Pages are enabledSharepoint is set to ignore ASPSharepoint allows ASPMost of the ASP pages work, it's only the ones that pass parameters that don't work. If I'm just returning data, everything works fine. If I choose a data type to return I get the error= Database Results Error Contact Administrator.Any idea
Syntax help, adding variable to form name   (398 Views)
Ok, I think I'm missing something simple in the syntax. Here goesI'm passing the following form field from a loopEach active get a uniquename via the classid. However, the classid in not sequential, so I cannot make it a simple arrayHow do I request the form nameactive = request.form("active") & classidThis didn't work. Anyone know the proper syntax
adding a second form field   (296 Views)
If your users are going to input their name at the same time as their email address, the solution is simple.Add CODE to your form.In the AddUser.asp file, do the following...Add CODE'create variable to hold nameDim NameName = Request.Form("NAME") to at the top of the page.Add CODEobjRec("NAME") = Name to your 'set the field equal to the variable' section of code.Should do the trick.
Problem adding record to table   (277 Views)
I am trying to add data to my database but keep getting the errorDatabase or object is read-onlyThis error is occuring on the "rstData.Update" line.My database is not read only and my wwwroot folder is not read only either.Any ideasJ
Bug whilst adding result.   (289 Views)
I've designed a site that is used for a league site in a game. The league is more like a ladder and is based on win streaks. I've designed an area where you add results in and the other team has to confirm before the result is added to their teams information and the ladder page.Now i've got the page working fine, but there is a bug if the scores of close:e.g.Round One: Team One: 3 Team Two: 2Round Two: Team One: 2 Team Two: 4Total: Team One: 5 Team Two: 6Meaning Team Two should be added to win.Normally my adding method works, but if a result is close like this the results are reversed, so Team One is entered as winning and Team Two is entered as losing. This only happens when the result is entered that way round so Team Two wins the second round with a larger score.Heres the code:If objRS("ResultConfirmClan2") = 1 Then strCoSo = Request.Form("coso") strCoSt = Request.Form("cost") strCtSo = Request.Form("ctso") strCtSt = Request.Form("ctst") strPos = 1 strClanID = Request.Form("clanone") If strPos = 1 Then strCoS = strCoSo + strCoSt strCtS = strCtSo + strCtSt ElseIf strPos = 2 Then strCtS = strCoSo + strCoSt strCoS = strCtSo + strCtSt End If strSQLUpdate = "SELECT * FROM tblClans WHERE ClanID = " & strClanID & "" Set objRSUpdate = Server.CreateObject("ADODB.RecordSet") objRSUpdate.Open strSQLUpdate, objConnC, adLockOptimistic, adCmdTable If strCoS > strCtS Then If objRSUpdate("ClanStreak") >= 0 Then objRSUpdate("ClanWins") = objRSUpdate("ClanWins") + 1 objRSUpdate("ClanStreak") = objRSUpdate("ClanStreak") + 1 objRSUpdate.Update ElseIf objRSUpdate("ClanStreak") < 0 Then objRSUpdate("ClanWins") = objRSUpdate("ClanWins") + 1 objRSUpdate("ClanStreak") = 1 objRSUpdate.Update End If ElseIf strCoS < strCtS Then If objRSUpdate("ClanStreak") =< 0 Then objRSUpdate("ClanLost") = objRSUpdate("ClanLost") + 1 objRSUpdate("ClanStreak") = objRSUpdate("ClanStreak") - 1 objRSUpdate.Update ElseIf objRSUpdate("ClanStreak") > 0 Then objRSUpdate("ClanLost") = objRSUpdate("ClanLost") + 1 objRSUpdate("ClanStreak") = -1 objRSUpdate.Update End If End If objRSUpdate.Close Set objRSUpdate = Nothing strPos = 2 strClanID = Request.Form("clantwo") If strPos = 1 Then strCoS = strCoSo + strCoSt strCtS = strCtSo + strCtSt ElseIf strPos = 2 Then strCtS = strCoSo + strCoSt strCoS = strCtSo + strCtSt End If strSQLUpdate = "SELECT * FROM tblClans WHERE ClanID = " & strClanID & "" Set objRSUpdate = Server.CreateObject("ADODB.RecordSet") objRSUpdate.Open strSQLUpdate, objConnC, adLockOptimistic, adCmdTable If strCoS > strCtS Then If objRSUpdate("ClanStreak") >= 0 Then objRSUpdate("ClanWins") = objRSUpdate("ClanWins") + 1 objRSUpdate("ClanStreak") = objRSUpdate("ClanStreak") + 1 objRSUpdate.Update ElseIf objRSUpdate("ClanStreak") < 0 Then objRSUpdate("ClanWins") = objRSUpdate("ClanWins") + 1 objRSUpdate("ClanStreak") = 1 objRSUpdate.Update End If ElseIf strCoS < strCtS Then If objRSUpdate("ClanStreak") =< 0 Then objRSUpdate("ClanLost") = objRSUpdate("ClanLost") + 1 objRSUpdate("ClanStreak") = objRSUpdate("ClanStreak") - 1 objRSUpdate.Update ElseIf objRSUpdate("ClanStreak") > 0 Then objRSUpdate("ClanLost") = objRSUpdate("ClanLost") + 1 objRSUpdate("ClanStreak") = -1 objRSUpdate.Update End If End If objRSUpdate.Close Set objRSUpdate = NothingEnd IfThis may be long but generally this works other than the bug i've mentioned.If anyone can help it would be great. Also if i've made no sense then say and i'll try and explain again.
adding asp variables   (272 Views)
First the code:Do while Not objRS.EOF If Count=1 Then ResValue=objRs.Fields("ResTime").Value ResCount=ResCount+Resvalue End if iRecordCount=iRecordCount+1 objRS.MoveNextLoopWhat I am attempting to do is loop through my database extracting the value for ResTime for each record, and adding the new value to the existing value so at the end I end up with a total figure.BUT I CAN'T GET THIS TO WORK.It just seems to concanenate the variable so if record 1=12 when it runs through to record 2, which say has a value of 15, it gives you 1215 instead of the sum of the two values, i.e. 27.I'm sure it's something simple but can't work it out
interger adding   (270 Views)
I want to do this... I have a table with 4 pics in each row. I want to have a count variable that will start with 1, and then count up to 4. Then when it gets to 4, i write out a new row and reset the count to 1.I can do the table, and all the other stuff, I just dount know how to make the count so that it's treated like an int. Kind of like in C++ where you can just declare int count. Get it thanx for any help. *Suzanne*
adding the month name to my database   (312 Views)
I have a dropdown menu that list each month of the year with the value of those months being the number. So the month of may would be a value of 05. When I submit the value of the dropdown menu I want it to go in as the name. Here is the statement that I used, but it doesn't work.select1 is the name of the dropdown menu. Can anyone tell me how I would modify this.rs("month")=request("select1" monthname(Month(date))
adding yes- nos to asp from access   (339 Views)
ello, I am trying to show Access data through an asp page, so my users can Edit the data. I can show most fields by using: value="" but when it comes to yes/no boxes using the above brings back blanks. what do I need to do to show the data. (the data is in 'on' or 'is null' form....
Remotely changing or adding tables to an access database   (356 Views)
I'm using an access database to feed my news site. Every time I make any changes to the structure of my database, I have to download the new database make the changes then re-upload it. How can I make the changes remotely using Microsoft Access
Accessing autonumber field when adding record   (318 Views)
I have some code which adds a record to a database. The primary key field is called Category_ID which is of type autonumber. I need to At present my code works as follows: Dim objConn, objRS, strSQL, strFailed Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open strConnect strSQL = "SELECT * FROM Categories WHERE Category_Title='" & category & "'" Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open strSQL, objConn,3,3 If objRS.EOF Then 'category not found so add this to database strFailed = "Category added to database" objRS.AddNew objRS("Category_Title") = category objRS.Update Else 'category already exists so do not add to database strFailed = "Category already exists - not added" End If 'end of if else checking username recordset for EOF objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing Dim objConn2, objRS2, strSQL2 Set objConn2 = Server.CreateObject("ADODB.Connection") objConn2.Open strConnect strSQL2 = "SELECT * FROM Categories WHERE Category_Title='" & category & "'" Set objRS2 = Server.CreateObject("ADODB.Recordset") objRS2.Open strSQL2, objConn2,3,3 If objRS2.EOF Then 'category not found so add this to database 'do nothing as category doesn't exist Else ' Dim recID, recFile objRS2.moveFirst recID = objRS2("Category_ID") recFile = "category" & recID & "." & extension objRS2("Category_Image") = recFile objRS2.Update End If 'end of if else checking username recordset for EOF objRS2.Close Set objRS2 = Nothing objConn2.Close Set objConn2 = Nothing Whilst my code works, it seems really inefficient and I thought there is probably an easier way of doing it. Basically the first blocks adds the category to the database. Then the second block retrieves the category ID and uses this to generate a filename which is saved into the database. My question after all this is: can I do this in one block of code in a more efficient way or do I just stick with my long winded solution above
Need help adding and deleting from query data from list box   (442 Views)
hello all, ive developed a list box in asp to query from the database and list the data i can post the whole file if you like ive created one for adding and one for deleting; thankyou again for the members who helped me last week please dont turn off your computer and run. im getting the following error when trying to add Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only. /copy/save.asp, line 40 line 40 being rsSubject.Update Code: Save Subject
adding link to a website;   (362 Views)
i try to put a link a on the website base on the field itself the value of is "htp://www.geocities.com/" then i do this code; but the it doesnt display the link anymore; the whole code is this; Help me pls
adding pages   (462 Views)
What would the code look like if wanted to add indexpages to my table, like : Code: set base=server.createobject("adodb.recordset") base.open "select * from mytable", "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("/db/mydb.mdb"), adopenkeyset, adlockoptimistic do while not base.EOF response.write base("name") & "" base.movenext loop Say i only want 25 records pr page, the rest is put in number links at bottom. can someone help me, i know this is easy stuff, but anyone
help help help shopping cart adding items to the cart   (375 Views)
hi , i am not able to add more than one items to the shopping cart can anyone help my code Code: Sub addtocart(iItemID, iItemCount) If dictCart.Exists(iItemID) Then dictCart(iItemID) = dictCart(iItemID) + iItemCount Else dictCart.Add iItemID, iItemCount END IF End Sub Dim dictCart If IsObject(Session("cart")) Then Set dictCart = Session("cart") Else Set dictCart=Server.CreateObject("Scripting.Dictionary") End If sAction= CStr(Request.Querystring("action")) iItemID= Request.Querystring("item") iItemCount= CInt(Request.Querystring("count")) Select Case sAction case "add" addtocart iItemID, iItemCount Case Else ShowFullCatalog End Select 'Set Session("cart") = dictCart error at line 65 which is last line in the gien code Microsoft VBScript runtime (0x800A01A8) Object required: 'dictCart' if last line is made comment the code works by adding one item to the cart & replaces the previously selected item.
adding data in 2 tables - Page 2   (424 Views)
hi , i had tried the code but there is no numeric field in those tables they are all text except for date which is of datatype date. Originally Posted by nofriends Dave is right, go throught the database and check which fields are numeric and remove the single quotes in the sql. hope this helps
Problem adding a record - Page 2   (388 Views)
Glad to help. Now don't forget to click on that little scales icon at the top right of this post :-)
adding page numbers on a search result page...   (420 Views)
I'm having problem adding page numbers on one of my search result page. The url search result would looks like this: http://www.mydomain.com/searchresult.aspUserName=Admin Now the code for page numbers is: For j=1 to objRS.pagecount If j=cINT(request("currentpage")) then response.write j Else %>
adding text to database via browser   (429 Views)
, I am trying to make a guestbook, wich should be accessable through a executable exe. I think, the easyest way to do this, is through your browser. I am looking how to add text to a database without entering text in a form, but only text in the address bar of your browser. the address should be something like this then: http://www.own3d.nl/guestbook/add_to_guestbook.asprsAddComments.Fields("Name")= ("name")rsAddComments.Fields("Comments")=("commen ts)" or something like that. i hope you can help me. Gr, Koen