Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: cannot insert, update and delete data from Access database


Message #1 by "Choong Shiau Suan" <jacylin79@y...> on Fri, 15 Nov 2002 06:54:15
hai all, need some help here...urgent!!
i am doing the asp programme now by using microsoft access 2000 in the 
remote server. i can retrieve all the data from the access database and 
display it on the web page, but the problem occurs when i try to insert / 
update or delete the data. 

the message error shown is 
?G???[ #-2147467259
?X?V?Â?\?È?N?G???Å? ?é?±?Æ?ª?K?v?Å?·?B

sorry but right now i am doing the japanese asp page. 
i have check the internet and notice that this is the provider error. i 
have try to insert the simple data straight on the server pc but the 
problem still occur. for u all information, i have already set the 
connection to mode 3 (adModeReadWrite) in my asp code, and i have already 
make sure that is the administrator login for the server. i have also try 
to insert the data by using the SQL Query in Microsoft Access, it works. 
so what will be the problem then?? 

will it be the problem because the access database is in readonly mode? 
can i ask how can i check the access database mode?
please help..the project is in urgent!!!

below is some of my coding...
the coding works well if i put into other PC, so i want to ask again will 
it be the problem of the server IIS?


<%
dim cs     'connection string
dim cn     'active connection

'Application("cs") = "Provider=Microsoft.Jet.OLEDB.4.0;Data 
Source=C://inetpub/wwwroot/data.mdb"

Function OpenDB()
    
  On Error Resume Next

  set cn = Server.CreateObject("ADODB.Connection")
  cn.Mode = 3        'adModeReadWrite
  cn.Open application("cs")

  if Err.number <> 0 then
        
      OnFailure Err.Number, Err.Description
      OpenDB = false
        
  else
    
      OpenDB = true
        
  end if    'for Err.number <> 0
    
  On Error GoTo 0
    
End Function    'end of Function OpenDB()

Function RunSQL(SQL)

  On Error Resume Next
    
  cn.Execute SQL
    
  if Err.number <> 0 then
        
       OnFailure Err.number, Err.description
       RunSQL = false
        
  else
        
       RunSQL = true
        
  end if    'for Err.Number <> 0
    
  On Error GoTo 0
    
End Function    'end of Function RunSQL(SQL)



If not OpenDB then Response.End
    
insertstr = "insert into report (Class, Project, Job) values 
('111', 'abc', 'yuyu')"
    
if not RunSQL(insertstr) then Response.End 
%>

  Return to Index