grwallace
asked on
Updating the tables with C1TrueDBGrid for .Net 2.0
I have the simplest if applications binding a a table to a Component1 True DB Grid for .net
I have used the VB6 version for years, but I am getting nowhere with this.
Can anyone help?
I have used the VB6 version for years, but I am getting nowhere with this.
Can anyone help?
or MyDataSet.Tables("TableNam e")
And the table should be filled with data ofcourse. MyDataAdapter.Fill(MyDataS et) for example.
ASKER
thanks for this _ can now populate the grid.
the next problem is getting it to update. If I am linked to a single table then I can create the update commands simply with the following function:-
Public Function CreateCommands()
Try
MyAdapter = Nothing
MyAdapter = New SqlClient.SqlDataAdapter(S elString, MyConn)
cmdBuilder1 = New SqlCommandBuilder(MyAdapte r)
OleDBCommand1 = New SqlCommand(SelString, MyConn)
MyAdapter.SelectCommand = OleDBCommand1
MyAdapter.DeleteCommand = cmdBuilder1.GetDeleteComma nd()
MyAdapter.InsertCommand = cmdBuilder1.GetInsertComma nd()
MyAdapter.UpdateCommand = cmdBuilder1.GetUpdateComma nd()
Catch ex As Exception
MessageBox.Show(ex.ToStrin g())
End Try
End Function
But if I have more than one table in the query then it doesn't work.
What I am looking for is something like:-
Table Products Table Sales
ProdId SalesId
PartNumber ProdId
Description Quantity
Price
To show on the grid:-
Part Number Description Quantity Price
AMC
the next problem is getting it to update. If I am linked to a single table then I can create the update commands simply with the following function:-
Public Function CreateCommands()
Try
MyAdapter = Nothing
MyAdapter = New SqlClient.SqlDataAdapter(S
cmdBuilder1 = New SqlCommandBuilder(MyAdapte
OleDBCommand1 = New SqlCommand(SelString, MyConn)
MyAdapter.SelectCommand = OleDBCommand1
MyAdapter.DeleteCommand = cmdBuilder1.GetDeleteComma
MyAdapter.InsertCommand = cmdBuilder1.GetInsertComma
MyAdapter.UpdateCommand = cmdBuilder1.GetUpdateComma
Catch ex As Exception
MessageBox.Show(ex.ToStrin
End Try
End Function
But if I have more than one table in the query then it doesn't work.
What I am looking for is something like:-
Table Products Table Sales
ProdId SalesId
PartNumber ProdId
Description Quantity
Price
To show on the grid:-
Part Number Description Quantity Price
AMC
ASKER
I made a mistake and posted before I was finished.
Featured Expert
nayernaguib
Ask An Expert Now!
Top 15
Overall
Programming
InteractiveMind 599052
cookre 546064
Idle_Mind 382247
Raisor 294440
jaime_olivares 274643
AlexFM 243630
Kavar 234568
Arthur_Wood 232497
pratap_r 216305
nayernaguib 214262
twalgrave 205843
julianH 194199
sunnycoder 186150
emoreau 178755
JesterToo 170309
Hall of Fame
What is your expert ranking?
Topic Area
Certified Expert
Your Level
Get Certified Now
Master 50,000
Guru 150,000
Wizard 300,000
Sage 500,000
Genius 1,000,000
Top 15
Yearly
Programming
InteractiveMind 207360
Raisor 157969
nayernaguib 133872
Idle_Mind 104731
nepostojeci_email 70390
bruintje 50442
liviutudor 49716
cookre 49378
JesterToo 43854
MilanKM 39082
bglodde 35694
angelIII 35372
AlexFM 34520
gabeso 34349
jhance 32812
Hall of Fame
Home All Topics Programming Viewing a Question
Search 1,591,186 Solutions
Search Help Restrict to this Topic Area Advanced Search
Title: Updating the tables with C1TrueDBGrid for .Net 2.0
asked by grwallace on 05/14/2006 05:21AM PDT
This question is worth 500 Points
I have the simplest if applications binding a a table to a Component1 True DB Grid for .net
I have used the VB6 version for years, but I am getting nowhere with this.
Can anyone help?
Send to a Friend Printer Friendly
Comment from vb_jonas
Date: 05/14/2006 10:04PM PDT
Comment
Doesnt this work?
c1TrueDBGrid1.DataSource = MyDataSet.MyDataTable
Comment from vb_jonas
Date: 05/14/2006 10:05PM PDT
Comment
or MyDataSet.Tables("TableNam e")
Comment from vb_jonas
Date: 05/14/2006 10:08PM PDT
Comment
And the table should be filled with data ofcourse. MyDataAdapter.Fill(MyDataS et) for example.
Comment from grwallace
Date: 05/18/2006 05:04AM PDT
Your Comment
thanks for this _ can now populate the grid.
the next problem is getting it to update. If I am linked to a single table then I can create the update commands simply with the following function:-
Public Function CreateCommands()
Try
MyAdapter = Nothing
MyAdapter = New SqlClient.SqlDataAdapter(S elString, MyConn)
cmdBuilder1 = New SqlCommandBuilder(MyAdapte r)
OleDBCommand1 = New SqlCommand(SelString, MyConn)
MyAdapter.SelectCommand = OleDBCommand1
MyAdapter.DeleteCommand = cmdBuilder1.GetDeleteComma nd()
MyAdapter.InsertCommand = cmdBuilder1.GetInsertComma nd()
MyAdapter.UpdateCommand = cmdBuilder1.GetUpdateComma nd()
Catch ex As Exception
MessageBox.Show(ex.ToStrin g())
End Try
End Function
But if I have more than one table in the query then it doesn't work.
What I am looking for is something like:-
Table Products Table Sales
ProdId SalesId
PartNumber ProdId
Description Quantity
Price
To show on the grid:-
Part Number Description Quantity Price
ABC Spool 1 10.00
DEF Washer 2 0.20
I need to be able to amend the quantity and the price, but perhaps not the part number and the description, but to do so also in the one action would be of use
Featured Expert
nayernaguib
Ask An Expert Now!
Top 15
Overall
Programming
InteractiveMind 599052
cookre 546064
Idle_Mind 382247
Raisor 294440
jaime_olivares 274643
AlexFM 243630
Kavar 234568
Arthur_Wood 232497
pratap_r 216305
nayernaguib 214262
twalgrave 205843
julianH 194199
sunnycoder 186150
emoreau 178755
JesterToo 170309
Hall of Fame
What is your expert ranking?
Topic Area
Certified Expert
Your Level
Get Certified Now
Master 50,000
Guru 150,000
Wizard 300,000
Sage 500,000
Genius 1,000,000
Top 15
Yearly
Programming
InteractiveMind 207360
Raisor 157969
nayernaguib 133872
Idle_Mind 104731
nepostojeci_email 70390
bruintje 50442
liviutudor 49716
cookre 49378
JesterToo 43854
MilanKM 39082
bglodde 35694
angelIII 35372
AlexFM 34520
gabeso 34349
jhance 32812
Hall of Fame
Home All Topics Programming Viewing a Question
Search 1,591,186 Solutions
Search Help Restrict to this Topic Area Advanced Search
Title: Updating the tables with C1TrueDBGrid for .Net 2.0
asked by grwallace on 05/14/2006 05:21AM PDT
This question is worth 500 Points
I have the simplest if applications binding a a table to a Component1 True DB Grid for .net
I have used the VB6 version for years, but I am getting nowhere with this.
Can anyone help?
Send to a Friend Printer Friendly
Comment from vb_jonas
Date: 05/14/2006 10:04PM PDT
Comment
Doesnt this work?
c1TrueDBGrid1.DataSource = MyDataSet.MyDataTable
Comment from vb_jonas
Date: 05/14/2006 10:05PM PDT
Comment
or MyDataSet.Tables("TableNam
Comment from vb_jonas
Date: 05/14/2006 10:08PM PDT
Comment
And the table should be filled with data ofcourse. MyDataAdapter.Fill(MyDataS
Comment from grwallace
Date: 05/18/2006 05:04AM PDT
Your Comment
thanks for this _ can now populate the grid.
the next problem is getting it to update. If I am linked to a single table then I can create the update commands simply with the following function:-
Public Function CreateCommands()
Try
MyAdapter = Nothing
MyAdapter = New SqlClient.SqlDataAdapter(S
cmdBuilder1 = New SqlCommandBuilder(MyAdapte
OleDBCommand1 = New SqlCommand(SelString, MyConn)
MyAdapter.SelectCommand = OleDBCommand1
MyAdapter.DeleteCommand = cmdBuilder1.GetDeleteComma
MyAdapter.InsertCommand = cmdBuilder1.GetInsertComma
MyAdapter.UpdateCommand = cmdBuilder1.GetUpdateComma
Catch ex As Exception
MessageBox.Show(ex.ToStrin
End Try
End Function
But if I have more than one table in the query then it doesn't work.
What I am looking for is something like:-
Table Products Table Sales
ProdId SalesId
PartNumber ProdId
Description Quantity
Price
To show on the grid:-
Part Number Description Quantity Price
ABC Spool 1 10.00
DEF Washer 2 0.20
I need to be able to amend the quantity and the price, but perhaps not the part number and the description, but to do so also in the one action would be of use
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
c1TrueDBGrid1.DataSource = MyDataSet.MyDataTable