Is There An Easy Way To Prevent Duplicate Records Being Added To A Access DB
I am adding simple records to a fairly simple access database with the following code
rsEntry.Fields("Player1") = ShortName(Player1)
rsEntry.Fields("Player2") = ShortName(Player2)
'Write the updated recordset to the database
rsEntry.Update
rsEntry.Close
adoCon.Close
Set rsEntry = Nothing
Set adoCon = Nothing
How can I SIMPLY :-) prevent duplicate records from being added? I know I can set the index property on the fields but that mean handling the errors - not sure how to do this.
OR I could write the code to seach the DB before update - which may be the only way :-(
Is there a simple way?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Check For Duplicate Records In MS Access
I made an asp that I insert records in an MS Access Database. I do insert them allright. But I want to check before inserting if this customer already exists. I try to do that by checking lastname and name (p_eponimo and p_onoma) but seems not to work ....
Prevent The Duplicate Value
i have a form by asp and database by MS access.so i want to prevent the duplicate value in empID because when i add a new employee with the same id ASP gives me this error. Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) [Microsoft][ODBC Microsoft Access Driver] The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again. /employee/admin/addemp1.asp, line 48 so i want the employee to get a message like this empID already exist or somthing like this.
Duplicate Records
My table in the database may contain duplicate records, which means except the primary key (auto_increment) field is unique, all or almost of all the fields are with the same content. How can I select them to display and delete them?
Duplicate SQL Records Created ?
I am trying to do a simple INSERT into SQL. I've done it tons of times before with the same code, but this time is is placing duplicate entries in the table. Any ideas why this would be happening? Here is my ASP code doing the form processing: <% set conn=server.createobject("adodb.connection") conn.Open "Driver={SQL Server}; Server=SERVERNAME; Database=DATABASENAME; UID=USER; PWD=PASSWORD" set rs = Server.CreateObject("ADODB.RecordSet") strTitle = Replace(request.Form("title"), "'", "'") strContent = Replace(request.Form("txtContent"), "'", "'") strSQL = "INSERT INTO [webPages] ([created], [section], [title], [content]) Values ('" & now() & "','" & request.Form("section") & "','" & strTitle & "','" & strContent & "')" rs.Open strSQL, conn, 3 %>
How To Handle Duplicate Records With ASP
I'm connecting to an MS Access database using ASP. Within my database I have duplicate records (more specifically records with the same serial no.). When I search by the serial number only the first record is displayed. I would like to display all records containing the given serial no.
Hide Duplicate Records
i want to hide duplicate record fields in an asp form, i have access database, e.g, i have a field schoolname, and studentname, 1 school have many students, so i want to print or display schoolname only once.
Duplicate Records With A Date Block
I am looking to create a calendar. I am stuck on how duplicate records based in a date parameter. Example A person is off between 12-01-04 to 12-09-04 . They submitted a form than contains the description. I want the record to duplicate 8 times because of the date paremeter.
Avoiding A Duplicate Entry To An Access DB Field
As part of a data input script, I ask for a user name to be input into an Access DB field called surprisingly, "UserName". I would like to ensure that username is not duplicated. How do I do that before inserting the data. My example show in the incomplete script below doesn't work? Code:
XP Update Added Asp
A few months ago, when I did an update from the windows update, a few of the 'necessary' updates had this like: microsoft net framework, MSXML, iis, asp. What are they and are they really necessary? There are a few more weird things that I have never seen previously, and if they really are not necessary, I would really like to remove them, if possible.
Content Not Being Added
I'm a designer by trade but the company I work for does asp via the built in Dreamweaver stuff. I've ran into this problem before and now twice this week. I can't remember how ai fixed it first time and actually think it was just down to luck rather than knowledge. I can retrieve the data out of the database table and delete it but when I try to add it from the admin form or modify it (i'm passing the variale fine as its fills the form in with all the relevant values) the page refreshes without adding the content or modifying the content. As I say I'm not writing the code but generating it via dreamweaver so don't really understand whats wrong.
Data Not Being Added To Database
I have a site and im trying to make a create account page for users to create an account. Unfortunately after getting everything working right i find out that for some reason the code is not adding the users to the database, i have double and even triple checked my sql connection string im at a complete and total loss Code:
Getting New Identity Of A Record Just Added
I have a web page that adds records to multiple tables. I want to be able to get the new identity of a new record that was just added to the table. If for some reason, it didn't add, I want an error message to show up. Here's the code in stored procedure for getting the new product id after the record was added. Code:
"duplicate" Web Access
I have http://localhost/myweb1 who redirect me to my pages. I would like to have http://localhost/myweb2 which I would like to use the same exact set of pages, except a different global.asa (application data will be different). If I duplicate pages, that is not a problem, but I would prefer not to duplicate them.
Needs A Way To Make Sure Data Is Correctly Added
How can I make sure that it adds all of the records to the table before I make Added = "True" It is strange, but sometimes, it won't add a record at all and then proceed to Added="True" How can I make sure that rs.Update was successful? Code:
MS Access Records
Is there a way to GROUP records from an MS Access database?I'm using Dreamweaver Ultradev 4.0-programming in VB Script.Macromedia says that stored procedures aren't available when using MS Access (Only MS SQL) and Grouping isn't available using MS Access.Id like to query the database and group the records like so Category A -- Item 1 -- Item 2 -- Item 3 Category B -- Item 5 -- Item 6 -- Item 7 i believe there's a way to hand code the query to work with MS Access.
Insert Records Access DB
Anyone know if it is possible to update/insert a database record into a dynamically specified field. The code I have here holds data in an asp session, ownerId, storeid and product type. I can insert a record into the Productcat table, fields OwnerId and surfboards, no problem. But what I would like is to insert the ownerid then insert poduct type into the field sepcified in the session variable (session("prodtype")) and/or strprodtpye For Example Insert OwnerId + product type into productcat into fileds ownerId and field labled ''strprodtype'' (variable, surfboard, wetsuit, boots, etc) SQLstatement = "INSERT INTO Productcat (Ownerid,'"&strprodtype&"') " I have tried using different methods, but the closest I got was IIS error msg ='field not found ("Surfboards", "wetsuits", "boots", etc)' Code:
Paging Access DB Records
I am trying to provide a paged listing of Access DB table data using ADO. I have a problem using the AbsolutePage method. I am using the following: [VBS] objRs.Open strSQL, objDbConn, adOpenStatic, adLockReadOnly, adCmdText objRs.PageSize = 5 objRs.CacheSize = 5 objRs.MoveFirst objRs.AbsolutePage = 24 Response.Write(objRs.AbsolutePage) Do While objRs.AbsolutePage = 24 And Not objPubRs.EOF Response.Write(objRs("data")) objRs.MoveNext Loop [/VBS] The line "Response.Write(objRs.AbsolutePage)" writes "-1" and the loop does not write any data. If I remove the "objRs.AbsolutePage = 24 And" from the loop test it will write recordset data starting with the proper page position but continues to the end of the recordset (including all following pages). With objRs.AbsolutePage reporting -1 I cannot test out of the loop based on the recordset page number.
Merge To Records In Access
I have a single table. ID Code Description Colour Qty 1 0001 T-Shirt Black 5 2 0002 Soccer Ball Red 1 3 0001 T-Shirt Black 2 4 0001 T-Shirt Navy 6 What I need to do using ASP is take record 1 and merge it with record 3. By this I mean I need to show only a singular qty for the product code 0001. i.e. ID Code Description Colour Qty 1 0001 T-Shirt Black 7 2 0002 Soccer Ball Red 1 4 0001 T-Shirt Navy 6
Moving Records In Access
Is it poss to move records from one table to another using ms access db to arcive records and how would i do that.
Asp : Compare Records In Two Access Databases
i've googeled to find a asp-script that can compare all the records in two different access databases the mdb's have exactly the same tables what i want is that (the output) all the differences comes in a html-table in a webpage can anybody help me, are give me a example ?
Format Records From Access Database
I have an access db from which I would like to display records in a formatted manner. I can display all the records one after the other on one page no problem, but I would like to display maybe 6 records on one page (3 across, 2 down). I would then need a page break for printing purposes. Displaying all the records on one page would be fine if I can put a page break in so that they print correctly. I currently have it fomatted correctly, but my loop is not working correctly. Instead of different records displaying, I have 6 of the same record displaying, then the next record displaying 6 times, etc. Even if it's better to do this over multiple pages, that would be fine as long as I can print the report with all records by clicking Print only once. Maybe even display the records on multiple pages with next and previous buttons, but when the user clicks print, then it would print a report from access. I hope this all makes sense. Does anyone have any ideas or suggestions or pointers on the best way to do this both for viewing and printing purposes? Code:
Carriage Return Being Strangely Added When I Perform A Standard Post
I am performing a post from one classic ASP page to another in order to get the value of a string passed between the two pages. I have a client script variable declared to take the value of the value being received in the page i.e. var x = '<%=varName%>'. Unfortunately, ASP seems to be adding a carriage return to the value of varName when it is passed in i.e. it expands the stated line to var x = 'FieldContents';. I.e. somewhere a carriage return has been added. The string gets passed in OK if I use the Get mechanism. Don't know why this carriage return is being added when using Post mechanism. Anybody seen this before? Is it a bug in ASP ?
Display Records From MS Access Tables As A Total In A Table In A ASP Page
I'm trying to display records from an MS Access DB (*.mdb) in an ASP page (table).. I don't want to display all the records though, I just want to display the total of these records..i.e in my table I would like to show how many calls someone has closed this year..(number) Joe Bloggs ---> 100 Closed Is this possible? I was thinking that I need to write an ADO that includes COUNT but I'm not too sure how to write this.. Here's what I have so far: Code:
Dropdown Menu/list Issue Pulling Records From Access Db
I am trying set up a page where the user can view records chosen by the year. I want to use a dropdown menu/list. Having trouble figuring out the sql behind this. My db table has about 10 fields in it, one of which is the year this record was created. i want the enduser to be able to enter the page, and first step is to select a year to view. Again, i want this to be chosen using a drop down menu. After clicking I would like the page to show a simple table pulling up all the records from that year. i know this sounds simple enough, but i cannot find this info/tutorial anywhere.. you guys are my only hope.
Easy Asp Question?
I need to do a string comparison (in asp) that checks to see if "META" is contained somewhere/anywhere in the string. Can anyone tell me the syntax for doing this?
Date (easy One)
<% Response.Write "" & FormatDateTime(now,2) & "" %> Gives me the date in MM/DD/YYYY. How can I reformat this to DD/MM/YYYY?
Easy Solution
I'm hoping for an easy solution to this that I'm not seeing that someone more experienced will. All I want to do it mark an option tag as selected.... <% hourCounter = 1 Do WHILE hourCounter <= 12 %> <option value="<%=hourCounter%>" <%If hourCounter = hour(rsCalendarEdit("fld_calendar_DateTime")) Then Response.write " selected" End If %>><%=hourCounter%></option> <% hourCounter = hourCounter + 1 Loop %> The trouble is if the time is "PM" I have a problem as you can see. Is there a method or property here I can implement that I'm not seeing?
Code Easy
why asp is retarded compared to some other server side scripting languages? or am i just the retard? Code: <% If Session("auth") = "1" And Session("userid") <> "" Then %> // Show user information box.... <% Else %> // Show login form.... <% End If %> in my head, what i just wrote should equal something like if the session variable "auth" equals 1 and the session variable "userid" does not equal nothing, then do this.well, i haven't set any session variables, and it's processing the chunk of code right after the above if/then. either shows a user information box or a login form.it shows the user information box, instead of the form. really baffles me considering i haven't set any session variables. i guess this is why i like php better, but i'm trying to get a grasp on asp, it just seems to hard to do something simple. can anyone tell me why that code is returning the wrong block of code?
Easy ASP Query
Using ASP & Access. So I am having a total brain-fade. I am trying to pull up data out of a table. But I want a "select all" option. What should the value be for the "select all" option of the form? What should the WHERE statement be in the query?
Convert An Easy Php Code To Asp
I am having trouble with our server host they are saying that the php upload limit is 20 mbs but using the code below with my flash file I can only get it to do 8mbs. I know that asp is allowing for up to 20mbs though so I was hoping that someone would be able to change this code to ASP(I am not very good at either php or asp). I think that should be pretty easy: <?php if (is_uploaded_file($_FILES['Filedata']['tmp_name'])) { $uploadDirectory = "uploads/"; $uploadFile = $uploadDirectory . basename($_FILES['Filedata']['name']); copy($_FILES['Filedata']['tmp_name'], $uploadFile); } ?>
Easy String Question
I am just trying to take pieces out of the sql statement individually and display them. I get this error: ADODB.Recordset (0x800A0CC1) Item cannot be found in the collection corresponding to the requested name or ordinal There is data there in the table and I'm not sure what's going on. Code:
Easy Site Creator
Im making an asp website for a rotary club what would be the best script to create a website something like a CMS without all the forums and stuff.
Easy Graph In Asp Or Html?
What is the easiest way to create a graph in either asp or html code? Is there one? I am doing several SQL queries the result of which I will give me a number. I need to put this number into some kind of graph (bar graph) on the page. THe number will vary so it must be some type of dynamicly created graph. I would prefer to not use a thrid party tool to do this if possible ......
Easy Date Handling
I'm working on a system that requires alot of date handling, and i'm getting pretty tired of doing custom calculating when modifying dates, so i hope someone would be able to help me. Is there any easy way to do re-calculating of dates? such as adding 2,11 or 36 months to a date, and have it automatically checking whether or not it should increase months or year, and by how much? Like, if i have to add 11 months to the date right now, i have to check which month it's in to see whether or not i could just take one month lesser the next year and so on.
Is There An Easy Way To Retieve The Key Value On INSERT
Basicly I have a table that gets contact info and stores it from a form AND emails me... Problem is I want to just email a link to the ContactInfo.. which should be referenced via the unique PK so whwn i view it, it would be nice to reference the row just inserted... ala view.asp?emailpk=141 figured there woudl be something like recaffected out there.
MVP Or MVC For Easy Migration From Winform To Asp.net
I need to write an application which should work as web application (ASP.NET) and it should have its counterpart for winforms - (they would do the same thing). My question is... what kind of pattern shall I use (MVP or MVC) for writing these apps to minimize overhead of rewriting code (e.g. I'll start writing winform app and then create similar web app )?
Adding Items To An Array - And Keeping Items Previously Added
I have a funtion that is supposed to add items in my shopping basket. It's an array, and each time the user is adding an item, it adds the item to the array with its quantity and size. I've never used arrays before, read about it, etc... The only problem is that when it adds the new product, it's not keeping the ones which were there before :-(. I have used REDIM PRESERVE. So can't find out what is wrong. Below are the funtions that i use for testing and the coding where I implement them. Code:
Should Be An Easy Form To Mail Question
I've searched the forum for the answer to this..it's probably on here somewhere but in a different guise to my particular question and I don't know enough to figure it out. If I have a basic form to mail ie strEmail = request.form("Email") and mail = "me@me.com" can I simply do this to get my form to be sent to 2 email addresses? mail = "me@me.com, you@me.com"
ObjNewMail.Body Question, I'm Sure Very Easy To Fix??
I have a "tell a friend" form and the backend sends the information just fine, however in the bodytext I want the "comments" box text to be added to the e-mail. User fills in his name, his email, friends email, comments box (name=message) and the email is sent except the text from the comments box. My code for the body tag is: objNewMail.Body = sendersName & " (mailto:" & sendersEmail & ") thought you would be interested in this article " & vbcrlf & vbcrlf & vbcrlf & "Link:" & vbcrlf & request.ServerVariables("HTTP_REFERER") How can I insert the comments box text in there? My thought was: objNewMail.Body = sendersName & " (mailto:" & sendersEmail & ") thought you would be interested in this article " & vbcrlf & vbcrlf & message & "Link:" & vbcrlf & request.ServerVariables("HTTP_REFERER") but it does not work.
Is There An Easy Way To Find Out If All OBJECTS Are Closed?
I have several pages ( ASP) that were working OK on NT4. We moved it to Server 2003. At random , it appears that the Server.CreateObject fails. I've looked through the code and it looks OK. Is there an easy way to make sure I have Closed all CONNECTIONS RecordSets etc.
Dynamic Menu Best Easy Methods
The database is used for referencing filename, there located folder, id, order shown, but also there are some fields say "location_1" up to "location_4" which have a 0 , 1 or 2 in them. 0 means that file not needed for that section. 1 means needed for that section, and 2 means mandantory (must be seen before exit). firstly selecting a location from a html radio box, drop down menu (not decided yet) will return whats needed so not showing pages what aint needed and wasting time. Here it is though in order on the left i wish it to build a menu, but more advanced than plain links would be good. drop down like windows explorer etc. Code:
How To Create This System Of Easy Form?
i would like to create the following one, but nor I know as. One index.asp that db catches one information as heading, hour of entrance and station time and shows in the page index. An example, let us assume that now they are 23:00, then the shown information will be inserted in the page index.asp in accordance with the current hour. If it will have something registered in cadastre in db that it starts the 23:00 and it finishes the 01:00 will be in index, passing the hour it leaves and it enters another message with programmed hour. If I have in db a message that would have to be shown of the 09:00 the 11:30, and now I am 11:20, the system analyze and show the information, until he is 11:31, when then I enter another one, and thus successively, they are menmsagens that in accordance with enter the hour of the server.
Easy Date Formatting Question
I have a variable that represents a standard mm/dd/yyyy date , but i want to change it to just October 6 '''' datepart("m","d" , mydatevariable) ''''' ....doesnt work.
Easy To Setup Web Chat For Windows?
i'm looking for a easy to setup web chat script that i can install on IIS? if someone can point me in the right direction it woudl be great, i download a couple cgi scripts but couldn't get them to load.
Is There An Easy Way To Find Out If All OBJECTS Are Closed?
I have several pages ( ASP) that were working OK on NT4. We moved it to Server 2003. At random , it appears that the Server.CreateObject fails. I've looked through the code and it looks OK. Is there an easy way to make sure I have Closed all CONNECTIONS RecordSets etc.
|