|
-
Oct 13th, 2000, 08:30 AM
#1
Thread Starter
New Member
I'll get this thing working if it kills me.
I have a datagrid whose datasource is a SQL query.
The infromation is displayed in the grid OK. When i click
on a cell to edit it i can change the value but when i click
on another cell i get the following message:-
'insufficient base table information for updating
or refreshing'
When i have the datasource as a single table i can
edit and update cells fine.
Can anyone point me in the right direction
Below is the code i use
___________________________________________________
Public Sub PopulateGrid()
Dim Cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
'frmMain.MyContractID = 1
dgdRateEntry.Visible = True
Set Cmd.ActiveConnection = frmMain.conn
Cmd.CommandType = adCmdText
Cmd.CommandText = "SELECT cl.event , cl.eventdescription, lp.Rate, " _
& "lp.rate as oldrate,'U' as flag" _
& " From linepayment lp,contractline cl" _
& " Where lp.contractlineid = cl.contractlineid" _
& " AND lp.contractid =" & frmMain.MyContractID & " Union" _
& " SELECT cl.event , cl.eventdescription, 0, " _
& " 0 as oldrate, 'I' as flag" _
& " From contractline cl " _
& " Where Not Exists" _
& " (Select * from linepayment lp " _
& " Where lp.contractlineid = cl.contractlineid " _
& " and lp.contractid=" & frmMain.MyContractID & ")"
rs.CursorType = adOpenDynamic
rs.CursorLocation = adUseClient
rs.Open Cmd, , adOpenDynamic, adLockOptimistic
Set dgdRateEntry.DataSource = rs
dgdRateEntry.ReBind
End Sub
_________________________________________________
Cheers
-
Oct 13th, 2000, 01:21 PM
#2
Addicted Member
Puma,
Sorry, this is not the solution to your problem, but I thought maybe you can help me...
Reading your post, I am trying to do something smilar. At design time, I don't know the name of the database I am going to access, so I can't bind it permanently to an ADO data control for instance.
Here is my code:
Code:
Dim cd As New ADODB.Command
Dim rs As New ADODB.Recordset
' That's the name that could change...
cd.ActiveConnection = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=c:\VB Projects\CD400\CD400.mdb;"
cd.CommandType = adCmdText
cd.CommandText = "select * from EMPLOYEE_IDS"
rs.Open cd, , adOpenStatic, adLockOptimistic
Set DataGrid.DataSource = rs
DataGrid.ReBind
I am getting the following error when executing the 'ReBind' method: "Cannot initialize data bindings"
Am I missing something ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|