Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > update recordset error


Reply
 
Thread Tools Display Modes
  #1  
Old 10-04-2002, 02:38 AM
pleth pleth is offline
Freshman
 
Join Date: Oct 2002
Posts: 40
Angry update recordset error


I am totally stumped on this one. Please, God, help me:

I have a set of code which updates an underlying Access table. I swear that I have seen it work in one place, then in another it will give me error numbers -2147467259 or -2147217864, with the cryptic messages that the "operation must use an updatable query" or "not enough base table information". Here's a sample of code:

Adodc1.Refresh
Adodc1.Recordset.MoveFirst
While (Not Adodc1.Recordset.EOF)
With Adodc1.Recordset
If intdummy = !scode Then
If Int(!CandNo) Mod Int(Text1.text) = 0 Then
intRoom = intRoom + 1
End If
If !CandNo < 226 Then
!Room = "0" & intRoom
Else
!Room = intRoom
End If
.Update
.MoveNext
Else
intRoom = 1
intdummy = !scode
End If
End With
Wend

All this does is put a bunch of people into different "rooms" based on group size defined by the user (text1.text). But it ALWAYS gets stuck on .Update. Why? I'm going crazy!
Reply With Quote
  #2  
Old 10-04-2002, 02:51 AM
sunbin sunbin is offline
Centurion
 
Join Date: Jul 2002
Location: -
Posts: 152
Default

Check if there is a value there for updating... Do u understand?

try using breakpoint to see if there is value for
Code:
If !CandNo < 226 Then !Room = "0" & intRoom Else !Room = intRoom End If
check !room etc.
if there is no vlaue, how can it update...

and one more thing.... make sure that the data type in the database is an "number"

Let's see wht's the problem will be
Reply With Quote
  #3  
Old 10-04-2002, 03:30 AM
pleth pleth is offline
Freshman
 
Join Date: Oct 2002
Posts: 40
Default

no, didn't work. all variables have values. sorry about the confusion with the dimension.... introom is actually a string variable. !room writes to a text field.

i'm telling you, this one is crazy!
Reply With Quote
  #4  
Old 10-04-2002, 07:02 AM
iowahawk43's Avatar
iowahawk43 iowahawk43 is offline
Contributor
 
Join Date: Aug 2002
Location: Iowa
Posts: 450
Default

It seems as if your settings might be for read-only, if you take the error message literally??? Check your properties in the adodc control...better yet, write code without the data control.

Hope this helps.
Reply With Quote
  #5  
Old 10-04-2002, 09:28 AM
vb6guru2
Guest
 
Posts: n/a
Default

There could be a few problems here. If your ADO Recordsource is a query, with joins that have no real PK in either of the tables, it will be a read only query regardless of the adodc settings.

Use:

Code:
Msgbox .Supports( adUpdate)

To determine if the recordset itself can perform an update. If not... there's your answer. If so... come on back.
Reply With Quote
  #6  
Old 10-04-2002, 10:22 AM
Mikecrosoft's Avatar
Mikecrosoft Mikecrosoft is offline
Mexican Coder
 
Join Date: Jun 2002
Location: Monterrey, N.L., Mexico
Posts: 2,793
Default

Where is the Adodc1.Recordset.AddNew ???
__________________
Mikecrosoft.NET
* If I stop to ask I will stop to learn
* Just I know that I don't know nothing
Reply With Quote
  #7  
Old 05-30-2003, 11:57 AM
martin82 martin82 is offline
Newcomer
 
Join Date: May 2003
Posts: 1
Default 'must use an updatable query'

This message is normally caused (from VB) by trying to do something to a DB that has been opened in 'Read' instead of 'ReadWrite' mode.

That's normally set in the DB connect string.










Quote:
Originally Posted by pleth
I am totally stumped on this one. Please, God, help me:

I have a set of code which updates an underlying Access table. I swear that I have seen it work in one place, then in another it will give me error numbers -2147467259 or -2147217864, with the cryptic messages that the "operation must use an updatable query" or "not enough base table information". Here's a sample of code:

Adodc1.Refresh
Adodc1.Recordset.MoveFirst
While (Not Adodc1.Recordset.EOF)
With Adodc1.Recordset
If intdummy = !scode Then
If Int(!CandNo) Mod Int(Text1.text) = 0 Then
intRoom = intRoom + 1
End If
If !CandNo < 226 Then
!Room = "0" & intRoom
Else
!Room = intRoom
End If
.Update
.MoveNext
Else
intRoom = 1
intdummy = !scode
End If
End With
Wend

All this does is put a bunch of people into different "rooms" based on group size defined by the user (text1.text). But it ALWAYS gets stuck on .Update. Why? I'm going crazy!

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->