Update databse frx

  • Thread starter Thread starter Marin
  • Start date Start date
M

Marin

I have problems with updating access database from asp.net 2.0 application.
I use this code:
SQL = "UPDATE Tabela Set Polje1=" & CInt(Text) & " WHERE ID=" &
CLng(Session("ID"))
cmd = New OleDbCommand(SQL, odbConn)
cmd.ExecuteNonQuery()

No compile error, no run-time error but database is not updated!! How to
update record in access database?
 
I have problems with updating access database from asp.net 2.0 application.
I use this code:
SQL = "UPDATE Tabela Set Polje1=" & CInt(Text) & " WHERE ID=" &
CLng(Session("ID"))
cmd = New OleDbCommand(SQL, odbConn)
cmd.ExecuteNonQuery()

No compile error, no run-time error but database is not updated!! How to
update record in access database?

It probably means that either Tabela has now records where
ID=Session("ID"), or Polje1=Text

Before you do an update, try to check what the values have Text and
Session("ID")

Response.Write("Text=" & Text)
Response.Write("ID=" & Session("ID"))
 
Print out the SQL statement so that you can see (or even better run it
yourself) in the DB to see if it works as expected (especially does the
criteria match)

Also if a file base db, make sure you are looking into the right db (in
vs.net you can have a copy option that always copy the file to the build
directory but if you works on this db keep in mind that the original db is
left unchanged).
 
Good suggestions all and make sure that JET has time to flush his cache. It
does not write to the database at first--just to the RAM cache. It only
flushes when the database connection is closed or it senses idle time.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
 
Back
Top