Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Updating base table in a join recordset


Message #1 by "Vinod Thomas" <vthomas@a...> on Thu, 19 Apr 2001 20:58:09
Thanks Tim , It worked perfectly

> You cannot use the adAffectAllChapters setting because you do not have a
> SHAPE recordset.  Leave the first Parameter black (which defaults to
> adAffectAll).  Next you will need to Resync your Recordset, like so:
> 
> With Recordset
>      Set .ActiveConnection = Cnn
>      .UpdateBatch [Leave Blank]
>      .Resync [Leave Blank],adResyncUnderlyingValues
>      Set .ActiveConnection = Nothing
> End With
> 
> If you do not Resync, you data will not be Updated to the Database.
> Also, you can set the "Unique Table" when you are Opening the 
Recordset.  It
> only needs to be set once, not everytime you Update.
> 
> Set Recordset = New ADODB.Recordset
> With Recordset
>      .CursorLocation = adUseClient
>      .Properties("Unique Table").Value = [Table Name]
>      .Open SQL, Cnn, adOpenStatic, adLockBatchOptimistic, adCmdText
>      Set .ActiveConnection = Nothing
> End With
> 
> 
> -----Original Message-----
> From: Vinod Thomas [mailto:vthomas@a...]
> Sent: Friday, April 20, 2001 4:00 PM
> To: professional vb
> Subject: [pro_vb] Re: Updating base table in a join recordset
> 
> 
> Thanks for helping
> I tried to keep a persistent connection, but still getting the same 
error.
> I am pasting the source code for connection,recorset and update script.
> Thanks
> Vinod
> 
> //connection string
> 
> With cnn
>  .ConnectionString = "Provider=MSDAORA.1;User ID=SysAdmin;password 
> =sysadm;Data Source=supk;Persist Security Info=False"
>     ' Open the connection
>     .Open
> End With
> 
> 
> // Recordset
> sqlstring = "Select bid_id,line_id,line_desc, 
> cont_bid_to_jobs.schedule_id," _
>                     & "b.schedule_desc,class_level_2,class_level_3," _
>                     & "cycle_start,org_lvl_5,bid_area,labor_level_2" _
>                     & " from cont_bid_to_jobs ,cont_schedule_type b " _
>                     & " where cont_bid_to_jobs.bid_id ='1'" _
>                     & " and cont_bid_to_jobs.schedule_id = 
b.schedule_id" _
>                     & " and b.division='TO'" _
>                     & " order by line_id"
>         
>         Set m_rsBidlines = New ADODB.Recordset
>         With m_rsBidlines
>           Set .ActiveConnection = cnn
>            .CursorLocation = adUseClient
>            .CursorType = adOpenKeyset
>            .LockType = adLockBatchOptimistic
>            .Source = sqlstring
>            .Open
>         End With
>  //Update script
> 
> Private Sub cmdUpdate_Click()
> With m_rsBidlines
> Set .ActiveConnection = cnn
> .Properties("Unique catalog") = "supk"
> .Properties("Unique schema") = "ats_adm"
> .Properties("Unique Table") = "cont_bid_to_jobs"
> .UpdateBatch adAffectAllChapters
> End With
> End Sub
> 
> 
> 
> 
> > It looks like from your Code example you are not connected back to the
> > Database when setting your Unique Table.
> > 
> > -----Original Message-----
> > From: Vinod Thomas [mailto:vthomas@a...]
> > Sent: Thursday, April 19, 2001 6:22 PM
> > To: professional vb
> > Subject: [pro_vb] Re: Updating base table in a join recordset
> > 
> > 
> > Addition to what I told before:
> > I tried soem more work. I used unique table, unique schema and unique 
> > catalog dynamic properties. when updating it is now giving the error 
> > message
> > runtime error -2147267259
> > unique table is nonexistent or not completely specified
> > I am using the correct table name
> > Thanks
> > Vinod
> > > How can I update one table in the recordset created with a join.
> > > I heard that by setting the dynamic property "unique table" , I can 
do 
> > > that. I tried that, but it is still trying to update the other table.
> > > 
> > > then code for recordset is 
> > > With m_rsBidLines
> > >           Set .ActiveConnection = cnn
> > >            .CursorLocation = adUseClient
> > >            .CursorType = adOpenKeyset
> > >            .LockType = adLockBatchOptimistic
> > >            .Source = sqlString
> > >            .Open
> > >         Set .ActiveConnection = Nothing
> > > end with
> > > setting dynamic property
> > > rsBidLines.properties("unique table") = <Table Name>
> > > 
> > > used Updatebatch on recordset.
> > > Thanks
> > 

  Return to Index