472,355 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,355 software developers and data experts.

Problem in Inserting new data in access database , Using ASP

Hi

I am Trying to insert data in M S Access through ASP, but it is neither showing any error nor updating the database. Please tell me ,where i am making the mistake
code:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <%
  3. set conn=Server.CreateObject("ADODB.Connection") 
  4. conn.open"gupta"
  5. set rs=server.createobject("ADODB.recordset")
  6. rs.activeconnection=conn
  7. rs.cursorlocation=2
  8. rs.cursortype=2
  9. rs.locktype=4
  10. rs.source="shweta_table"
  11. rs.open 
  12. rs.addnew
  13. rs("name")="kim"
  14. rs("age")="26"
  15. rs.update
  16. %>
  17. </html>
  18.  
I am using:
OS: window xp
server: IIS
Database:MS ACCESS
Browser: Internet Explorer

Also,please tell me how to insert data in database through ASP(using sql).
as when i wrote code:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body><%
  3. set conn=Server.CreateObject("ADODB.Connection")
  4. conn.Open "gupta"
  5. sql="INSERT INTO shweta_tables values('kim','27')" 
  6. conn.Execute sql,recaffected
  7. if err<>0 then
  8.   Response.Write("No update permissions!")
  9. else 
  10.   Response.Write("<h3>" & recaffected & " record added</h3>")
  11. end if
  12. conn.close
  13. %>
  14.  
  15. </body>
  16. </html>
  17.  
It give me 'No update permissions'

Thanks
Shweta
Oct 30 '06 #1
1 2934
Hi

I am Trying to insert data in M S Access through ASP, but it is neither showing any error nor updating the database. Please tell me ,where i am making the mistake
code:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <%
  3. set conn=Server.CreateObject("ADODB.Connection") 
  4. conn.open"gupta"
  5. set rs=server.createobject("ADODB.recordset")
  6. rs.activeconnection=conn
  7. rs.cursorlocation=2
  8. rs.cursortype=2
  9. rs.locktype=4
  10. rs.source="shweta_table"
  11. rs.open 
  12. rs.addnew
  13. rs("name")="kim"
  14. rs("age")="26"
  15. rs.update
  16. %>
  17. </html>
  18.  
If I'm reading this correctly, what record is this updating? Or is it suppose to update everything in the "name" & "age" to the "kim" & "26"

I'm am guessing that the rs.source="shweta_table" needs something to attach it to a record that it suppose to be updating. Can be something like this

Expand|Select|Wrap|Line Numbers
  1. rs.source="shweta_table WHERE id = "a variable something(maybe an autonumber id)"
  2.  


I am using:
OS: window xp
server: IIS
Database:MS ACCESS
Browser: Internet Explorer

Also,please tell me how to insert data in database through ASP(using sql).
as when i wrote code:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body><%
  3. set conn=Server.CreateObject("ADODB.Connection")
  4. conn.Open "gupta"
  5. sql="INSERT INTO shweta_tables values('kim','27')" 
  6. conn.Execute sql,recaffected
  7. if err<>0 then
  8.   Response.Write("No update permissions!")
  9. else 
  10.   Response.Write("<h3>" & recaffected & " record added</h3>")
  11. end if
  12. conn.close
  13. %>
  14.  
  15. </body>
  16. </html>
  17.  
It give me 'No update permissions'

Thanks
Shweta

If i remember correctly the insert needs to know where you want to place the info your sending.

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO shweta_tables (name, age) VALUES ('kim', '27') 
  2.  
Does that help or work?

-Will
Oct 31 '06 #2

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

Similar topics

3
by: DarthMacgyver | last post by:
Hello, I recently wrote a survey application. Each question is very similar. The first questions gives me a problem when there are multiple people taking the survey (The Database connection...
7
by: Jared Evans | last post by:
I developed a console application that will continually check a message queue to watch for any incoming data that needs to be inserted into MS SQL database. What would be a low-cost method I...
5
by: hfk0 | last post by:
Hi, I'm new to ASP.net, SQL Server and visual studio.net, and I'm having problem inserting and storing data from a web form to a SQL database. I created a simple ASP.NET web form, a simple SQL...
15
by: yzlin04 | last post by:
Hello, I'm new in vb.net. I have a problem in inserting a new row to a MS Access database table. There is no error message comes out when i run my program, but when i check my MS Access table,...
3
by: Surya | last post by:
Dear All, I have problem on inserting a record to database..Although it looked easy.. i have caught up with following issue .. please go ahead and help me to find solution I Need to insert...
20
by: dav3 | last post by:
Alright folks I am in need of a lil guidance/assistance here. I have a program which reads in a txt file. This txt file contains lines of the form January 3, 2007, 85.8 Now each line of the txt...
6
by: ashes | last post by:
Hi, I am creating an ecommerce website using Microsoft Visual Studio, VB.Net and MS Access 2003. I am new to VB.Net When someone wants to register on the website, they fill out a form and the...
2
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography...
2
by: hakkatil | last post by:
Hi to all, I have a page that inserts excel sheet to access database. I am using asp. What I want to do is to check the inserting record if it is in the database. Basicly checking the dublicate...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...

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.