Filter Column in DataSet

  • Thread starter Thread starter jason
  • Start date Start date
J

jason

I'll try to explain in detail what it is I'm struggling
with. I created a SQL database with one table called
CallSheet which contains the following columns:

Caller ID: <--Primary Key, auto indexed by my SQL server
From:
Company:
Status:
Date:
Phone Primary:
Phone Secondary:
Completed: <--boolean

here is the Select statement being used my my
sqldataadapter:

Select *
from CallSheet
Where completed = false

I used the where clause to try to keep from pulling down
the entire database everytime it loaded the dataset. So
at this point, I have a dataset loaded using the fill
method that displays all columns. And that's not too
bad, but there are few things that are bugging me that I
can't seem to figure out how to fix(listed by priority):

1) When the application runs, people don't need to see
the Caller ID or Completed columns. How can I filter
which columns are displayed in the dataset during runtime?

2) How can I set the column width for each of the columns
in the dataset? I realize that during runtime I can
modify them via dragging, but I would like to be able to
save people from having to do that. Anybody got any
ideas?

3) Ok, one other thing..how can I print the actual
dataset? Not the windows form, I need to output the
dataset for printing somehow, lots of documentation talks
about printing text files and such..but no one talks
about printing from datasets.

Any ideas would be appreciated, this is my first
application with Visual Basic .net, just trying to get my
feet wet.

Thanks a ton

Jason
 
Hi Jason,

Answer to the first question:

select from, company, status, ddate, phonep, phones from callsheet where
completed = false

Note that you don't have to have completed in the column list and can still
call it in the where clause. Also, the order of columns is completely up to
you.

2nd q - setting the column width suggests you are in a datagrid, right? I
use the component one grid so much that I don't remember how to set widths,
but look at the object model - it has to be simple to do.

3rd q - to print the dataset, use the crystal report viewer/designer (which
comes with vs .net).

HTH,

Bernie Yaeger
 
-----Original Message-----
Hi Jason,

Answer to the first question:

select from, company, status, ddate, phonep, phones from callsheet where
completed = false

Note that you don't have to have completed in the column list and can still
call it in the where clause. Also, the order of columns is completely up to
you.

You are correct, but I need to be able to modify the
completed column. How can I modify it unless it's a part
of my dataset? I want it to be there, that way I can
continue to use a datarow variable to set it when users
use the application? Do you know a way that I can modify
that variable without having to have it in a dataset?

2nd q - setting the column width suggests you are in a datagrid, right? I
use the component one grid so much that I don't remember how to set widths,
but look at the object model - it has to be simple to do.

The component one grid? I don't suppose you have a link
for that somewhere, I'd love to find something other than
a dataset. (of course, if I wasn't so green, I might do a
little better at it)
3rd q - to print the dataset, use the crystal report viewer/designer (which
comes with vs .net).

Doesn't that mean I would have to put crystal reports on
every machine?? I thought crystal reports was more for
the developer, not the end users using the application.
Or is that wrong?
 
Hi Jason,

In order to modify a column that is not in a datatable (which is the table
or tables inside a dataset), you would have to write a stored procedure
which refers to that column even though it isn't in the datatable that is
available to the end user. More simply, you could include the column but
hide it (by setting its visible property to false) inside the datagrid
wherein it is being displayed.

The MS datagrid is fine, to my recollection, but the Component One grid is
much more flexible and performs magnificently. You can learn more about it
at www.componentone.com. There are many, many other 3rd party .net grids,
and many of them look to be very useful as well, so you should look at
others as well. If you enter '.net datagrid' in google, you should be able
to begin reviewing several of these. They're all pretty expensive, but most
come with a suite of other useful controls - costs range from about $300 to
$800 or so (which includes all of the controls).

No, you would not have to deploy crystal on all of the pc's that use the
app. You would simply have to have a setup routine that installs the
necessary .dlls. Crystal has tutorials on how to do this - it's not
exceptionally difficult. You might begin by going to
www.crystaldecisions.com for some guidance. But think about it, Jason.
You'll have to build more and more sophisticated reports as time goes by -
you're not going to get anywhere, practically speaking, without a useful
report writer. And of course the end user doesn't interact with CR - they
simply perform the appropriate button click and your code executes the
report.

HTH,

Bernie
 
Back
Top