PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Can' update access mdb with asp.net VB Microsoft.Jet.OLEDB.4.0

 
 
jason@cyberpine.com
Guest
Posts: n/a
 
      11th Feb 2005
Perhaps this is the wrong group - but having no luck. My source is
below . I am able to add and delete with similar code. I get no errors
messages. Displays look good. thank you for any help or information.


<code>

Public Sub UserGrid_Update (Source As Object, E As
DataGridCommandEventArgs)
Dim objConn as new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=db.mdb")

Dim cmd As OleDbCommand = new OleDbCommand ("UPDATE tbl SET
responsible=@responsible,status=@status,waitingon=@waitingon,comments=@comments
WHERE chain=@chain", objConn)


Dim schain As String = e.Item.Cells(2).Text
Dim sresponsible As String = CType(e.Item.Cells(3).Controls (0),
TextBox).Text
Dim sstatus As String = CType(e.Item.Cells(4).Controls (0),
TextBox).Text
Dim swaitingon As String = CType(e.Item.Cells(5).Controls (0),
TextBox).Text
Dim scomments As String = CType(e.Item.Cells(6).Controls (0),
TextBox).Text


response.write(schain+"-"+sresponsible+"-"+sstatus+"-"+swaitingon+"-"+scomments)

cmd.Parameters.Add(new OleDbParameter("@chain", schain))
cmd.Parameters.Add(new OleDbParameter("@responsible",
sresponsible))
cmd.Parameters.Add(new OleDbParameter("@status", sstatus))
cmd.Parameters.Add(new OleDbParameter("@waitingon", swaitingon))

cmd.Parameters.Add(new OleDbParameter("@comments", scomments))

Try

objConn.Open()
cmd.ExecuteNonQuery()
objConn.Close

Catch ex As Exception
response.write(ex.Message & ex.stacktrace)
End Try


</end code>

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QnJpYW4gQnJvd24=?=
Guest
Posts: n/a
 
      11th Feb 2005
Hi Jason,

Have you checked the update statement to make sure that schain is being
populated correctly? If it is run that statement from inside Access and see
if it works. If it is not getting populated with the correct information
then the UPDATE Command will not find a row to update. Resulting in no error
but also no row updated. If this is not it please reply to this post with
details so the group may help you more.

Good Luck.
 
Reply With Quote
 
jason@cyberpine.com
Guest
Posts: n/a
 
      12th Feb 2005
yes, all the s values display as expected.

I don't know the access 2000 rdbms, where can I execute an update
statement?

 
Reply With Quote
 
jason@cyberpine.com
Guest
Posts: n/a
 
      12th Feb 2005
I can make the update work with fixed values. all the s variables are
getting set, only the @chain gets set however, all others @varialbes
either revert back or are never passed to the update. any idea?

 
Reply With Quote
 
=?Utf-8?B?QnJpYW4gQnJvd24=?=
Guest
Posts: n/a
 
      14th Feb 2005
Hi Jason,

Sorry for the late reply. You can run update statements within Access by
going to the query designer creating a new query and then pulling down the
box in the upper left hand corner to the SQL icon. If you can't find it look
up "View or modify the SQL statement behind an existing query" in the Access
help.

Can you post the code so I can give it a look? I took the code that you
have in your first post and ran it in a sample program and it ran fine.
This leads me to believe that the problem lies in the section of code that
populates the values of the query. Have you tried to create a sample program
to see if you can emulate the behavior? If you have can you post this code?
Please reply to this post so the group may help you better.

I look forward to your reply.
----------------------------------
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft Access 2003 OleDb INSERT/UPDATE Terry Olsen Microsoft ADO .NET 0 21st Dec 2007 06:16 AM
Joining FoxPro Tables in Microsoft Access via OLEDB TerryJayFoster@gmail.com Microsoft Access External Data 6 12th Jul 2007 01:03 PM
New Microsoft.ACE.OLEDB.12.0 / MS ACCESS 2007 format pros ? mibainfo Microsoft Access Queries 1 7th Mar 2007 10:19 AM
New Microsoft.ACE.OLEDB.12.0 / MS ACCESS 2007 format pros ? mibainfo Microsoft Access 1 5th Mar 2007 06:51 PM
OleDb and Microsoft Access Mythran Microsoft VB .NET 0 7th Apr 2006 11:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:13 AM.