dataset question

G

Guest

I have a winform that calls a database and i generate a dataset to populate
my datagrid, now I allow the user to click on a cell in the datagrid which
then populates text boxes with details on the user selection. doing this i
make another call to the database. which i would like to avoid if possible.

It is possible to use the same dataset that is populating the datagrid and
filter on that to populate my textboxes? the dataset is pulling everything
back that i need and i'm only showing certain dataitems in the grid to start
with.

thx
 
C

Cor Ligthert

Barney,

Of course it is possible however you will see that when you load to much,
that in a multiuser environment it is the best to have as less as possible
in your datasets. (as fresh as possible)

(Or there should not be updates be involved).

I hope this gives an idea

Cor
 
G

Guest

right now in my dataset, i'm only pulling back 15 dataitems but it's going to
go to 25 dataitems, MAX.

do you have an example on how i can do this in a WinForm environment?
 
C

Cor Ligthert

Barney,

Reading it again I see I maybe understood you wrong.

I made a (as small as possible) sample for you give it a try and when you
want to know more, than reply with that question.

\\\needs a datagrid and a textbox in a new project on form1
Private Sub Form1_Load(ByVal sender _
As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim dt As DataTable = createds()
Dim dv As New DataView(dt)
DataGrid1.DataSource = dv
TextBox1.DataBindings.Add(New Binding("Text", dv, "Two"))
End Sub
Public Function createds() As DataTable
Dim dt As New DataTable
dt.Columns.Add("One")
dt.Columns.Add("Two")
For i As Integer = 0 To 10
dt.Rows.Add(dt.NewRow)
dt.Rows(i).ItemArray = New Object() _
{i, ChrW(i + 65)}
Next
Return dt
End Function
///

I hope this helps a little bit?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top