Total Newbie Question about query and reports
I have a MS SQL database with one table and 5 columns, approximately 100 rows of data.
Table is called Employees.
Columns are called: ID, BDate, Age, Weight, Race
I have created a form called Search with 2 text fields called txtID and txtWeight. It has a button that the user will use to activate the report.
I want to create report that is generated based on a query that uses the txtID field as it criteria. How do I create that query that will take whatever is typed into the txtID field as its paramater.
Thanks for all your help.
[571 byte] By [
RonaldL] at [2007-12-25]
If you have VB 2005 you can let it do a lot of the work and write much less code.
Please check out- How to connect to an existing database
And then- How to work with TableAdapters:
http://msdn2.microsoft.com/en-US/library/bz9tthwx.aspx
http://msdn2.microsoft.com/en-US/library/ms171920.aspx
You should be able to automatically create the TableAdapters that fill datasets and the strongly typed datasets to store the data. Create an additional query called FillByMyParameter(@Parameter). Then you can write code like this:
Dim ds as new CCUGDB
Dim ta as new customersTableAdapter
ta.FillByMyParameter(ds.Customers, "p06")
This will populate a table in a dataset which can then be used in conjunction with the datagridview control by
By setting the Datagridview datasource and datamember properties and the datagridview will populate with all the data in the datatable.
Hope this helps.
Ok, I got a query running to a datagrid. How do I get multiple columns from more than one table to show up on the grid or preferrably a report. I have a relation ship defined and when I preview the query all the columns I want show up, but I cannot get them on a report or datagrid.