|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
insert statement
..i tried to insert data's to a table and its working ..but the only problem is when i click the button Submit(to add data)its adding 2 rows of data...1 is the data's which i entered n the other 1 is a blank row of data...so when i log out n run the form again..error occured..saying that confilcts in a primary key..coz there is a blank rows in the table...how can i overcome this prob...
the code is like this <% dim connstring,strsql dim strname,stremail strname=request.form("frmname") stremail=request.form("frmemail") connstring="Provider=SQLOLEDB;User ID="name";Password="password" set my_conn=server.createobject("ADODB.Connection") my_conn.Open connstring strsql="INSERT INTO UserEmails(Name,email)values("&"'"&strName&'",'"&stremail&"')" set rs=my_conn.execute(strsql) %> |
|
#2
|
|||
|
|||
|
Your sql doesn't look like it should do 2 inserts. Is it possible you are somehow calling this code twice from somewhere else?
|
|
#3
|
||||
|
||||
|
maybe you forgot to make your primary key auto-incrementing thus creating the error on record insertion.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > insert statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|