Update databse frx

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?
 
G

Guest

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"))
 
P

Patrice

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).
 
W

William \(Bill\) Vaughn

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)
-----------------------------------------------------------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top