473,503 Members | 2,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Insert statement problem

145 New Member
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.
Oct 11 '09 #1
7 1908
puT3
145 New Member
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
Oct 11 '09 #2
puT3
145 New Member
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
Expand|Select|Wrap|Line Numbers
  1. sql2="INSERT INTO Login (Username,UserPassword) VALUES ('"+user_Name+"','"+pass_Word+"')";
  2. Conn.Execute(sql2);
  3.  
  4. 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+"')";
  5. Conn.Execute(sql);
  6.  
Oct 11 '09 #3
jhardman
3,406 Recognized Expert Specialist
Try your query outside of ASP first. Try it in a query analyzer and see what it results.

Jared
Oct 12 '09 #4
puT3
145 New Member
Sorry but how to analyze inser statement in access...
Oct 13 '09 #5
jhardman
3,406 Recognized Expert Specialist
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
Oct 13 '09 #6
puT3
145 New Member
alright...i will try it...i'll let you know...
Oct 14 '09 #7
gcube
17 New Member
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.
Oct 20 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

8
5501
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE,...
14
4269
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to...
16
16975
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
10
3375
by: Mike | last post by:
I know this sounds strange but I am at a loss. I am calling a simple funtion that opens a connection to a SQL Server 2000 database and executes an Insert Statement. private void...
3
2014
by: alexmaster_2004 | last post by:
hi i have made an application using C# that access sql2000. this application is just used to insert data to the database. i use something like this in my code: // string colmnA = TextBox1.Text;...
3
2805
by: Neil Zanella | last post by:
Hello, I am trying to execute ADO.NET INSERT statement where one of the fields is coming from a password HTML control. When I access the text with password.Value and print with Response.Write...
9
1792
by: Jack | last post by:
Hi, I am gathering the input values to a form using Request.form method from the processing page. After all the data is captured, I am building sql statement out of it. Using a response.write...
6
3439
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am...
8
5016
by: Red | last post by:
If auto-format is turned off in VS2008, there is apparently no way to indent a line. Under Tools->Options->Text Editor->C#->Formatting, there are three checkboxes. Unchecking those seems to cause...
1
2497
by: Maklar60 | last post by:
I am attempting to execute an INSERT statement on my page but continually get the following error: Microsoft OLE DB Provider for ODBC Drivers error '80040e14' Incorrect syntax near '<'. ...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7348
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7006
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5592
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4685
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3166
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1519
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.