|
-
Jul 11th, 2004, 10:59 PM
#1
Thread Starter
Lively Member
I have an error I can't seem to debug..
hi everyone...
What do you think this error means? Or how can I solve this error?
Data cannot be read from a Datagrid which is not bound to a DataTable.
This only happens when I try to bind the two fields in my database table QuoteDoc.
FYI, my table QuoteDoc has a relation with another table QuoteTran. If my explanation is not that clear, please feel free to ask...
I will greatly appreciate your help!
thanks!
-
Jul 12th, 2004, 12:08 AM
#2
Sleep mode
Are you trying to bind two relational tables to a datagrid ?
-
Jul 12th, 2004, 07:48 PM
#3
Thread Starter
Lively Member
thanks for replying pirate...
yes and I already have. To make it clearer, here's my code...
Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click
Try
ds.Clear()
daDoc.Fill(ds, "QuoteDoc")
daTran.Fill(ds, "QuoteTran")
ds.Relations.Add("DocTran", ds.Tables!QuoteDoc.Columns!Reference, ds.Tables!QuoteTran.Columns!Reference)
txtRef.DataBindings.Add("Text", ds.Tables!QuoteDoc, "Reference")
dtpQuote.DataBindings.Add("Text", ds.Tables!QuoteDoc, "QuoteDate")
cmbTerms.DataBindings.Add("Text", ds.Tables!QuoteDoc, "TermsID")
txtCustomer.DataBindings.Add("Text", ds.Tables!QuoteDoc, "CustomerID")
txtdiscount.DataBindings.Add("Text", ds.Tables!QuoteDoc, "Discount") -->THIS PRODUCES THE ERROR
txtspldiscount.DataBindings.Add("Text", ds.Tables!QuoteDoc, "SplDiscount") --> AND THIS ONE TOO
txtgrand.DataBindings.Add("Text", ds.Tables!QuoteDoc, "QuoteTotal")
DataGrid1.DataSource = ds.Tables!QuoteDoc
DataGrid1.DataMember = "DocTran"
cm = CType(Me.BindingContext(ds.Tables!QuoteDoc), CurrencyManager)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OKOnly, "Error")
End Try
btnFirst.Enabled = True
btnnext.Enabled = True
btnprevious.Enabled = True
btnnext.Enabled = True
btnlast.Enabled = True
End Sub
when i included these two lines to my codes, it produces that error. i can't understand why because i used the same codes like those of the others. please help me pirate...
-
Jul 12th, 2004, 08:35 PM
#4
Sleep mode
I'm sorry , I never worked with complex binding. Just hate binding. Here's an
example that might help .
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
|