add records to an access database using asp

Hi experts,
   I'm trying to add records to an access database using asp. Please see my code below that I'm using. Its not working. I ;m having an error at line 39  which is "conn.execute(ins)". I'm trying what I know , but its not solving the problem. Please tell me what to do.

My code are
<html>
<link rel="stylesheet" type="text/css" href="../main.css">
<!--#include file="connect.asp" -->
<link rel="stylesheet" type="text/css" href="../main.css">
<body>
<%


fname=request("fname")
lname=request("lname")
address=request("address")
city=request("city")
state=request("state")
country=request("country")
phone=request("phone")
email=request("email")
p_name=request("p_name")
password1=request("password1")
flag=request("flag")



Set rsAddComments1 = Server.CreateObject("ADODB.Recordset")
sql="select count(*) from login1 where username1='"&p_name&"' "


rsAddComments1.Open sql, Conn
set rr=conn.execute(sql)
rsAddComments1.close

'if  not flag="ins" and rr(0)=0  then
'      'response.write "record found"
'      ins1 ="update customer set firstname='"&fname&"',lastname='"&lname&"',add1='"&address&"',city='"&city&"',"
'      ins1= ins1 & "state='"&state&"',country='"&country&"',phone="&phone&",email='"&email&"' where userid="&userid(0)&" "
'      conn.execute(ins1)
'      response.write(" Record must be in Data Base & Update")
'else
if flag="ins" then

      ins ="insert into login1(username1,password1) values('"&p_name&"','"&password1&"')"
      conn.execute(ins)

      sql="select userid from login1 where username1='"&p_name&"'"
      set userid=conn.execute(sql)
      'response.write userid(0)

      ins1 ="insert into customer(firstname,lastname,add1,city,state,country,phone,email,userid)"
      ins1 = ins1 & "values('"&fname&"','"&lname&"','"&address&"','"&city&"','"&state&"','"&country&"'"
      ins1 = ins1 & ","&phone&",'"&email&"',"&userid(0)&")"
else
        sql="select userid from login1 where username1='"&session("userid")&"'"
      set userid=conn.execute(sql)
        userid = session("userid")
      ins1 ="update customer set firstname='"&fname&"',lastname='"&lname&"',add1='"&address&"',city='"&city&"',"
      ins1= ins1 & "state='"&state&"',country='"&country&"',phone="&phone&",email='"&email&"' where userid="&userid&""
      

end if
'response.write ins1


conn.execute(ins1)


'end if
 
'response.end
    tt=session("psoid")
   


%>
<B> Your Data Has been saved</b><br><br><br><br><br>
<br><font face="Wingdings" color="#008000">Q  </font><a href="update_profile.asp" >Update profile</a>
<br>
<font face="Wingdings" color="#008000">Q  </font><a href="chg_pass.asp" >Change Password</a><BR>
<font face="Wingdings" color="#008000">Q  </font><a href="flight_search.asp" >reservation and cancelation</a>


<br>

</body>
</html>
sharfaaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jmelikaCommented:
What is the full error message?  Is your connection opened before you execute the SQL?  conn.Open?  You need to open it (conn.Open) and then conn.Close when done with it.

Try:
conn.Open
conn.execute(ins1)
conn.Close
0
ZvonkoSystems architectCommented:
What is Conn in your source?
Is it ConnectionString or object of type ADODB.Connection?

Look here: http:Q_10770301.html
0
ZvonkoSystems architectCommented:
I mean in this two lines it is first used as connection string and in the next line as connection object:

rsAddComments1.Open sql, Conn
set rr=conn.execute(sql)

0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

jmelikaCommented:
Sorry about the type in my code.  Here is the right code

conn.Open sql
conn.execute(ins1)
conn.Close
0
sharfaaAuthor Commented:
none of your answers have solved the problem. Please see where I have left the mistakes
0
sharfaaAuthor Commented:
This is the error that I have in my browser

Technical Information (for support personnel)

Error Type:
ADODB.Connection (0x800A0E79)
Operation is not allowed when the object is open.
/airline/member/input_submit.asp, line 41


0
fritz_the_blankCommented:
What is the content of:

<--#include file="connect.asp" -->


FtB
0
sharfaaAuthor Commented:
Hi Mr Genius,
I very happy that you are looking at my question

here is your answer of connect.asp

<html>
<body>
<%
set Conn = Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/Inetpub/wwwroot/airline/airm.mdb"
%>
</body>
</html>
0
fritz_the_blankCommented:
Okay, we are going to do a little trouble shooting step by step. In a new page, try this and then tell me the result.

<html>
<link rel="stylesheet" type="text/css" href="../main.css">
<link rel="stylesheet" type="text/css" href="../main.css">
<body>
<%

set Conn = Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/Inetpub/wwwroot/airline/airm.mdb"

Response.write("The connection state is: " & Conn.state)
Response.end

fname=request("fname")
lname=request("lname")
address=request("address")
city=request("city")
state=request("state")
country=request("country")
phone=request("phone")
email=request("email")
p_name=request("p_name")
password1=request("password1")
flag=request("flag")



Set rsAddComments1 = Server.CreateObject("ADODB.Recordset")
sql="select count(*) from login1 where username1='"&p_name&"' "


rsAddComments1.Open sql, Conn
set rr=conn.execute(sql)
rsAddComments1.close

'if  not flag="ins" and rr(0)=0  then
'     'response.write "record found"
'     ins1 ="update customer set firstname='"&fname&"',lastname='"&lname&"',add1='"&address&"',city='"&city&"',"
'     ins1= ins1 & "state='"&state&"',country='"&country&"',phone="&phone&",email='"&email&"' where userid="&userid(0)&" "
'     conn.execute(ins1)
'     response.write(" Record must be in Data Base & Update")
'else
if flag="ins" then

     ins ="insert into login1(username1,password1) values('"&p_name&"','"&password1&"')"
     conn.execute(ins)

     sql="select userid from login1 where username1='"&p_name&"'"
     set userid=conn.execute(sql)
     'response.write userid(0)

     ins1 ="insert into customer(firstname,lastname,add1,city,state,country,phone,email,userid)"
     ins1 = ins1 & "values('"&fname&"','"&lname&"','"&address&"','"&city&"','"&state&"','"&country&"'"
     ins1 = ins1 & ","&phone&",'"&email&"',"&userid(0)&")"
else
        sql="select userid from login1 where username1='"&session("userid")&"'"
     set userid=conn.execute(sql)
        userid = session("userid")
     ins1 ="update customer set firstname='"&fname&"',lastname='"&lname&"',add1='"&address&"',city='"&city&"',"
     ins1= ins1 & "state='"&state&"',country='"&country&"',phone="&phone&",email='"&email&"' where userid="&userid&""
     

end if
'response.write ins1


conn.execute(ins1)


'end if
 
'response.end
    tt=session("psoid")
   


%>
<B> Your Data Has been saved</b><br><br><br><br><br>
<br><font face="Wingdings" color="#008000">Q  </font><a href="update_profile.asp" >Update profile</a>
<br>
<font face="Wingdings" color="#008000">Q  </font><a href="chg_pass.asp" >Change Password</a><BR>
<font face="Wingdings" color="#008000">Q  </font><a href="flight_search.asp" >reservation and cancelation</a>


<br>

</body>
</html>
0
sharfaaAuthor Commented:
The result is as follows

The connection state is: 1
0
fritz_the_blankCommented:
Excellent!

Hang on a second for the next step.

FtB
0
fritz_the_blankCommented:
<html>
<link rel="stylesheet" type="text/css" href="../main.css">
<link rel="stylesheet" type="text/css" href="../main.css">
<body>
<%

set Conn = Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/Inetpub/wwwroot/airline/airm.mdb"

fname=request("fname")
lname=request("lname")
address=request("address")
city=request("city")
state=request("state")
country=request("country")
phone=request("phone")
email=request("email")
p_name=request("p_name")
password1=request("password1")
flag=request("flag")



Set rsAddComments1 = Server.CreateObject("ADODB.Recordset")
sql="select count(*) from login1 where username1='"&p_name&"' "


rsAddComments1.Open sql, Conn


Response.write("The rsAddComments1 state is: " & rsAddComments1.state)
Response.end


set rr=conn.execute(sql)
rsAddComments1.close

'if  not flag="ins" and rr(0)=0  then
'     'response.write "record found"
'     ins1 ="update customer set firstname='"&fname&"',lastname='"&lname&"',add1='"&address&"',city='"&city&"',"
'     ins1= ins1 & "state='"&state&"',country='"&country&"',phone="&phone&",email='"&email&"' where userid="&userid(0)&" "
'     conn.execute(ins1)
'     response.write(" Record must be in Data Base & Update")
'else
if flag="ins" then

     ins ="insert into login1(username1,password1) values('"&p_name&"','"&password1&"')"
     conn.execute(ins)

     sql="select userid from login1 where username1='"&p_name&"'"
     set userid=conn.execute(sql)
     'response.write userid(0)

     ins1 ="insert into customer(firstname,lastname,add1,city,state,country,phone,email,userid)"
     ins1 = ins1 & "values('"&fname&"','"&lname&"','"&address&"','"&city&"','"&state&"','"&country&"'"
     ins1 = ins1 & ","&phone&",'"&email&"',"&userid(0)&")"
else
        sql="select userid from login1 where username1='"&session("userid")&"'"
     set userid=conn.execute(sql)
        userid = session("userid")
     ins1 ="update customer set firstname='"&fname&"',lastname='"&lname&"',add1='"&address&"',city='"&city&"',"
     ins1= ins1 & "state='"&state&"',country='"&country&"',phone="&phone&",email='"&email&"' where userid="&userid&""
     

end if
'response.write ins1


conn.execute(ins1)


'end if
 
'response.end
    tt=session("psoid")
   


%>
<B> Your Data Has been saved</b><br><br><br><br><br>
<br><font face="Wingdings" color="#008000">Q  </font><a href="update_profile.asp" >Update profile</a>
<br>
<font face="Wingdings" color="#008000">Q  </font><a href="chg_pass.asp" >Change Password</a><BR>
<font face="Wingdings" color="#008000">Q  </font><a href="flight_search.asp" >reservation and cancelation</a>


<br>

</body>
</html>
0
sharfaaAuthor Commented:
new result

The rsAddComments1 state is: 1

0
fritz_the_blankCommented:
Looking good! Hang on for a minute for the next bit.

FtB
0
fritz_the_blankCommented:
<html>
<link rel="stylesheet" type="text/css" href="../main.css">
<link rel="stylesheet" type="text/css" href="../main.css">
<body>
<%

set Conn = Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/Inetpub/wwwroot/airline/airm.mdb"

fname=request("fname")
lname=request("lname")
address=request("address")
city=request("city")
state=request("state")
country=request("country")
phone=request("phone")
email=request("email")
p_name=request("p_name")
password1=request("password1")
flag=request("flag")



Set rsAddComments1 = Server.CreateObject("ADODB.Recordset")
sql="select count(*) from login1 where username1='"&p_name&"' "


rsAddComments1.Open sql, Conn


set rr=conn.execute(sql)
rsAddComments1.close

'if  not flag="ins" and rr(0)=0  then
'     'response.write "record found"
'     ins1 ="update customer set firstname='"&fname&"',lastname='"&lname&"',add1='"&address&"',city='"&city&"',"
'     ins1= ins1 & "state='"&state&"',country='"&country&"',phone="&phone&",email='"&email&"' where userid="&userid(0)&" "
'     conn.execute(ins1)
'     response.write(" Record must be in Data Base & Update")
'else
if flag="ins" then
   
     ins ="insert into login1(username1,password1) values('"&p_name&"','"&password1&"')"
     response.write("ins sql: " & ins)
       response.end

       conn.execute(ins)

     sql="select userid from login1 where username1='"&p_name&"'"
     set userid=conn.execute(sql)
     'response.write userid(0)

     ins1 ="insert into customer(firstname,lastname,add1,city,state,country,phone,email,userid)"
     ins1 = ins1 & "values('"&fname&"','"&lname&"','"&address&"','"&city&"','"&state&"','"&country&"'"
     ins1 = ins1 & ","&phone&",'"&email&"',"&userid(0)&")"
else
        sql="select userid from login1 where username1='"&session("userid")&"'"
     set userid=conn.execute(sql)
        userid = session("userid")
     ins1 ="update customer set firstname='"&fname&"',lastname='"&lname&"',add1='"&address&"',city='"&city&"',"
     ins1= ins1 & "state='"&state&"',country='"&country&"',phone="&phone&",email='"&email&"' where userid="&userid&""
     

end if
'response.write ins1


conn.execute(ins1)


'end if
 
'response.end
    tt=session("psoid")
   


%>
<B> Your Data Has been saved</b><br><br><br><br><br>
<br><font face="Wingdings" color="#008000">Q  </font><a href="update_profile.asp" >Update profile</a>
<br>
<font face="Wingdings" color="#008000">Q  </font><a href="chg_pass.asp" >Change Password</a><BR>
<font face="Wingdings" color="#008000">Q  </font><a href="flight_search.asp" >reservation and cancelation</a>


<br>

</body>
</html>
0
sharfaaAuthor Commented:
next result

ins sql: insert into login1(username1,password1) values('masa','pass')
0
fritz_the_blankCommented:
Next:

<html>
<link rel="stylesheet" type="text/css" href="../main.css">
<link rel="stylesheet" type="text/css" href="../main.css">
<body>
<%

set Conn = Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/Inetpub/wwwroot/airline/airm.mdb"

fname=request("fname")
lname=request("lname")
address=request("address")
city=request("city")
state=request("state")
country=request("country")
phone=request("phone")
email=request("email")
p_name=request("p_name")
password1=request("password1")
flag=request("flag")



Set rsAddComments1 = Server.CreateObject("ADODB.Recordset")
sql="select count(*) from login1 where username1='"&p_name&"' "


rsAddComments1.Open sql, Conn


set rr=conn.execute(sql)
rsAddComments1.close

'if  not flag="ins" and rr(0)=0  then
'     'response.write "record found"
'     ins1 ="update customer set firstname='"&fname&"',lastname='"&lname&"',add1='"&address&"',city='"&city&"',"
'     ins1= ins1 & "state='"&state&"',country='"&country&"',phone="&phone&",email='"&email&"' where userid="&userid(0)&" "
'     conn.execute(ins1)
'     response.write(" Record must be in Data Base & Update")
'else
if flag="ins" then
   
     ins ="insert into login1(username1,password1) values('"&p_name&"','"&password1&"')"

       conn.execute(ins)
     response.write("Insert Executed!")
       response.end


     sql="select userid from login1 where username1='"&p_name&"'"
     set userid=conn.execute(sql)
     'response.write userid(0)

     ins1 ="insert into customer(firstname,lastname,add1,city,state,country,phone,email,userid)"
     ins1 = ins1 & "values('"&fname&"','"&lname&"','"&address&"','"&city&"','"&state&"','"&country&"'"
     ins1 = ins1 & ","&phone&",'"&email&"',"&userid(0)&")"
else
        sql="select userid from login1 where username1='"&session("userid")&"'"
     set userid=conn.execute(sql)
        userid = session("userid")
     ins1 ="update customer set firstname='"&fname&"',lastname='"&lname&"',add1='"&address&"',city='"&city&"',"
     ins1= ins1 & "state='"&state&"',country='"&country&"',phone="&phone&",email='"&email&"' where userid="&userid&""
     

end if
'response.write ins1


conn.execute(ins1)


'end if
 
'response.end
    tt=session("psoid")
   


%>
<B> Your Data Has been saved</b><br><br><br><br><br>
<br><font face="Wingdings" color="#008000">Q  </font><a href="update_profile.asp" >Update profile</a>
<br>
<font face="Wingdings" color="#008000">Q  </font><a href="chg_pass.asp" >Change Password</a><BR>
<font face="Wingdings" color="#008000">Q  </font><a href="flight_search.asp" >reservation and cancelation</a>


<br>

</body>
</html>
0
sharfaaAuthor Commented:
as seen in browser

Technical Information (for support personnel)

Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
/airline/member/input_submit.asp, line 46


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

Page:
POST 182 bytes to /airline/member/input_submit.asp

POST Data:
flag=ins&fname=Ashraf&lname=AUBAD&address=rouillard&city=Terre-Rouge&state=Pamplemousses&country=Mauritius&phone=5490261&email=masa@trop.com&p_name=masa&password1=pass&password2=pass

Time:
Sunday, November 14, 2004, 2:44:21 AM
0
fritz_the_blankCommented:
Okay great. Please hang on a minute.

FtB
0
fritz_the_blankCommented:
We are down to one of two or three problems. Please try this:

<html>
<link rel="stylesheet" type="text/css" href="../main.css">
<link rel="stylesheet" type="text/css" href="../main.css">
<body>
<%
set Conn = Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/Inetpub/wwwroot/airline/airm.mdb"

strDataPath = "c:/Inetpub/wwwroot/airline/airm.mdb"
set conn=Server.CreateObject("ADODB.Connection")
strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;"_
                  + " Data Source= " & strDataPath & ";"_
                  + " Mode=Share Deny None;PASSWORD=;"

conn.ConnectionTimeout = 15
conn.CommandTimeout =  10
conn.Mode = 3 'adModeReadWrite
if conn.state = 0 then
      conn.Open strConnectString
end if

fname=request("fname")
lname=request("lname")
address=request("address")
city=request("city")
state=request("state")
country=request("country")
phone=request("phone")
email=request("email")
p_name=request("p_name")
password1=request("password1")
flag=request("flag")



Set rsAddComments1 = Server.CreateObject("ADODB.Recordset")
sql="select count(*) from login1 where username1='"&p_name&"' "


rsAddComments1.Open sql, Conn


set rr=conn.execute(sql)
rsAddComments1.close

'if  not flag="ins" and rr(0)=0  then
'     'response.write "record found"
'     ins1 ="update customer set firstname='"&fname&"',lastname='"&lname&"',add1='"&address&"',city='"&city&"',"
'     ins1= ins1 & "state='"&state&"',country='"&country&"',phone="&phone&",email='"&email&"' where userid="&userid(0)&" "
'     conn.execute(ins1)
'     response.write(" Record must be in Data Base & Update")
'else
if flag="ins" then
   
     ins ="insert into login1(username1,password1) values('"&p_name&"','"&password1&"')"

       conn.execute(ins)
     response.write("Insert Executed!")
       response.end


     sql="select userid from login1 where username1='"&p_name&"'"
     set userid=conn.execute(sql)
     'response.write userid(0)

     ins1 ="insert into customer(firstname,lastname,add1,city,state,country,phone,email,userid)"
     ins1 = ins1 & "values('"&fname&"','"&lname&"','"&address&"','"&city&"','"&state&"','"&country&"'"
     ins1 = ins1 & ","&phone&",'"&email&"',"&userid(0)&")"
else
        sql="select userid from login1 where username1='"&session("userid")&"'"
     set userid=conn.execute(sql)
        userid = session("userid")
     ins1 ="update customer set firstname='"&fname&"',lastname='"&lname&"',add1='"&address&"',city='"&city&"',"
     ins1= ins1 & "state='"&state&"',country='"&country&"',phone="&phone&",email='"&email&"' where userid="&userid&""
     

end if
'response.write ins1


conn.execute(ins1)


'end if
 
'response.end
    tt=session("psoid")
   


%>
<B> Your Data Has been saved</b><br><br><br><br><br>
<br><font face="Wingdings" color="#008000">Q  </font><a href="update_profile.asp" >Update profile</a>
<br>
<font face="Wingdings" color="#008000">Q  </font><a href="chg_pass.asp" >Change Password</a><BR>
<font face="Wingdings" color="#008000">Q  </font><a href="flight_search.asp" >reservation and cancelation</a>


<br>

</body>
</html>

FtB
0
sharfaaAuthor Commented:
Latest result
Technical Information (for support personnel)

Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
/airline/member/input_submit.asp, line 58


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

Page:
POST 182 bytes to /airline/member/input_submit.asp

POST Data:
flag=ins&fname=Ashraf&lname=AUBAD&address=rouillard&city=Terre-Rouge&state=Pamplemousses&country=Mauritius&phone=5490261&email=masa@trop.com&p_name=masa&password1=pass&password2=pass

Time:
Sunday, November 14, 2004, 2:51:19 AM
0
fritz_the_blankCommented:
Okay, I think that I know what is going on now--it looks like you have a permissions issue. Is this your server or a hosting server? What we need is for the IUSR_ account to have READ/WRITE permissions for the airline/ directory. Also, right click on the .mdb file to make certain that it is not read only.

FtB

0
sharfaaAuthor Commented:
I'm using my own machine as server-Simulating with IIS
0
sharfaaAuthor Commented:
Have check permission on mdb-Its not read only
0
sharfaaAuthor Commented:
can I upload my pages somewhere-so that you have a better idea of the problem
0
fritz_the_blankCommented:
Okay, so visit the airline directory, right click on it to check the permissions. The IUSR_ account must have READ/WRITE permissions.

FtB
0
fritz_the_blankCommented:
That won't help--what I need is to see your server. In any event, please see my last comment about the IUSR permissions.

FtB
0
sharfaaAuthor Commented:
Now i have this comments after checking the permissions with IIS server

Insert Executed!
0
fritz_the_blankCommented:
Excellent. Can you verify that the record was inserted?

ftB
0
fritz_the_blankCommented:
If so, then your code should look like this to go all of the way through:

<html>
<link rel="stylesheet" type="text/css" href="../main.css">
<link rel="stylesheet" type="text/css" href="../main.css">
<body>
<%
set Conn = Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/Inetpub/wwwroot/airline/airm.mdb"

strDataPath = "c:/Inetpub/wwwroot/airline/airm.mdb"
set conn=Server.CreateObject("ADODB.Connection")
strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;"_
                  + " Data Source= " & strDataPath & ";"_
                  + " Mode=Share Deny None;PASSWORD=;"

conn.ConnectionTimeout = 15
conn.CommandTimeout =  10
conn.Mode = 3 'adModeReadWrite
if conn.state = 0 then
      conn.Open strConnectString
end if

fname=request("fname")
lname=request("lname")
address=request("address")
city=request("city")
state=request("state")
country=request("country")
phone=request("phone")
email=request("email")
p_name=request("p_name")
password1=request("password1")
flag=request("flag")



Set rsAddComments1 = Server.CreateObject("ADODB.Recordset")
sql="select count(*) from login1 where username1='"&p_name&"' "


rsAddComments1.Open sql, Conn


set rr=conn.execute(sql)
rsAddComments1.close

'if  not flag="ins" and rr(0)=0  then
'     'response.write "record found"
'     ins1 ="update customer set firstname='"&fname&"',lastname='"&lname&"',add1='"&address&"',city='"&city&"',"
'     ins1= ins1 & "state='"&state&"',country='"&country&"',phone="&phone&",email='"&email&"' where userid="&userid(0)&" "
'     conn.execute(ins1)
'     response.write(" Record must be in Data Base & Update")
'else
if flag="ins" then
   
     ins ="insert into login1(username1,password1) values('"&p_name&"','"&password1&"')"
       conn.execute(ins)

     sql="select userid from login1 where username1='"&p_name&"'"
     set userid=conn.execute(sql)
     'response.write userid(0)

     ins1 ="insert into customer(firstname,lastname,add1,city,state,country,phone,email,userid)"
     ins1 = ins1 & "values('"&fname&"','"&lname&"','"&address&"','"&city&"','"&state&"','"&country&"'"
     ins1 = ins1 & ","&phone&",'"&email&"',"&userid(0)&")"
else
        sql="select userid from login1 where username1='"&session("userid")&"'"
     set userid=conn.execute(sql)
        userid = session("userid")
     ins1 ="update customer set firstname='"&fname&"',lastname='"&lname&"',add1='"&address&"',city='"&city&"',"
     ins1= ins1 & "state='"&state&"',country='"&country&"',phone="&phone&",email='"&email&"' where userid="&userid&""
     

end if
'response.write ins1
conn.execute(ins1)
'end if

'response.end
    tt=session("psoid")
 %>
<B> Your Data Has been saved</b><br><br><br><br><br>
<br><font face="Wingdings" color="#008000">Q  </font><a href="update_profile.asp" >Update profile</a>
<br>
<font face="Wingdings" color="#008000">Q  </font><a href="chg_pass.asp" >Change Password</a><BR>
<font face="Wingdings" color="#008000">Q  </font><a href="flight_search.asp" >reservation and cancelation</a>
</body>
</html>

FtB
0
sharfaaAuthor Commented:
Yes the record was inserted in the login table
0
fritz_the_blankCommented:
Okay, then the code above should be fine. I would recommend copying and pasting my connection code into your include file and then putting the include statement back into your page. Also, be sure to put:

conn.close
set conn = Nothing


at the bottom of your page. Do the same with each recordset you create.

ftB
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sharfaaAuthor Commented:
Thanks a lot for your effort-Now I know where the problem was-It has to do with permissions as you have said
You are really a genius in ASP

thanks
0
fritz_the_blankCommented:
Glad to have helped,

FtB

PS: Some good folks were helping you out earlier as well.

0
ZvonkoSystems architectCommented:
Come on Fritz, I would never guessed that the problem was access rights ;-)
I was only wondering why he executes the sql string twice!

rsAddComments1.Open sql, Conn

set rr=conn.execute(sql) '// << isn't this a problem before close() ???

rsAddComments1.close
0
fritz_the_blankCommented:
I don't think so--you just get another recordset.

FtB
0
ZvonkoSystems architectCommented:
Ok, thanks.
0
fritz_the_blankCommented:
But please don't quote me on that!!!! I prefer to do things more explicitly so that I can set the properties of the objects myself. i.e.:

dim rr
set rr = server.CreateObject("ADODB.RecordSet")
rr.Open strSQL,conn,3,3




0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.