Insert statement problem | Member | | Join Date: Jul 2008
Posts: 123
| | |
i want to insert new record from asp file into database, i insert the data for example,product name(Cream Puff), price(1.00), quantity(100pcs) but then when i open my database it display "undefined' for all the field.
| | Member | | Join Date: Jul 2008
Posts: 123
| | | re: Insert statement problem
From the earlier question, i have another error which is it mentioned that there are multiple same data in the table because it a primary key...Sorry i do not remember exactly the error but it soething like that when im inserting new record...I usign asp(javascript) and access
| | Member | | Join Date: Jul 2008
Posts: 123
| | | re: Insert statement problem
The error for question 2,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.
the sql i use -
sql2="INSERT INTO Login (Username,UserPassword) VALUES ('"+user_Name+"','"+pass_Word+"')";
-
Conn.Execute(sql2);
-
-
sql="INSERT INTO Customer(Customer_ICNumber,Cust_Name,Cust_Address,Cust_PrimaryNumber,Cust_SecondaryNumber,Cust_Company,Cust_CompanyType,Username)VALUES ('"+cust_ICNumber+"','"+cust_Name+"','"+cust_Address+"','"+cust_Primary+"','"+cust_secondary+"','"+cust_Company+"','"+cust_CompanyType+"','"+user_Name+"')";
-
Conn.Execute(sql);
-
|  | Moderator | | Join Date: Jan 2007 Location: logan, utah
Posts: 2,690
| | | re: Insert statement problem
Try your query outside of ASP first. Try it in a query analyzer and see what it results.
Jared
| | Member | | Join Date: Jul 2008
Posts: 123
| | | re: Insert statement problem
Sorry but how to analyze inser statement in access...
|  | Moderator | | Join Date: Jan 2007 Location: logan, utah
Posts: 2,690
| | | re: Insert statement problem
I don't use access anymore, but I have Access 2007 on my work computer. I got to a query analyzer by opening access and selecting a table, then I clicked "query tools" and it tried to get me to enter data via a graphical user interface, but I won by clicking "view" -> "SQL view". This provided a large textbox where I could enter the text of the query and a button marked "run". Hope this helps.
Jared
| | Member | | Join Date: Jul 2008
Posts: 123
| | | re: Insert statement problem
alright...i will try it...i'll let you know...
| | Newbie | | Join Date: Oct 2009 Location: Grant, AL
Posts: 17
| | | re: Insert statement problem
That error message is telling you that at least one of the fields you are trying to enter data for is required to have a unique value and that the value submitted is already in another record.
Open Access and open the table in design view. If there is a field that has an icon that looks like a yellow key at the left of the line, then that field must be unique. Also, select each field (one at a time) and look at the field properties at the bottom of the field list - if any field has "yes" for "indexed" then that field must also be unique.
There is one other thing you should check. If there are any fields in the table that you are not trying to record values for, be sure that the field properties for all of them either have "no" for "required" and have "yes" for "allow zero length" or have a default value assigned.
This should identify the field or fields causing the error.
|  | Similar ASP / Active Server Pages bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,533 network members.
|