Custom Columheader
-
How do you pull data from a database and set them as columnheader in listview or a datagrid?:((
Are you using a stored procedure? Give more info about your requirements... Later
-
Are you using a stored procedure? Give more info about your requirements... Later
Student_Name Teacher_Namer Subject Time Date James Keith Prof. Clark Math 9:00am 01/05/2004 James Keith Prof. Moore English 10:00am 01/05/2004 James Keith Prof. Smith Art 11:00am 01/05/2004 James Keith Prof. James P.E 1:00pm 01/05/2004 James Keith Prof. Brooke Chem 2:00pm 01/05/2004 James Keith Prof. Daniels Math 3:00pm 01/05/2004 Peter Robertson Prof. Clark Math 8:00am 01/05/2004 Peter Robertson Prof. Moore English 12:00am 01/05/2004 Peter Robertson Prof. Smith Art 4:00pm 01/05/2004 Peter Robertson Prof. James P.E 5:00pm 01/05/2004 Peter Robertson Prof. Brooke Chem 6:00pm 01/05/2004 Peter Robertson Prof. Daniels Math 7:00pm 01/05/2004 Teachers + Prof. Clark + Prof. Brooke + Prof. Daniels +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Time +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8:00 + Peter Robertson + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 9:00 + James Keith + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 10:00 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 11:00 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 12:00 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1:00 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2:00 + + James Keith +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ The list view will be controlled by a date or calendar control. Haven’t decided whether to use a stored procedure. Since I use a select statement with a case argument. Still not getting the look I want. It would be similar to a cross tab table used in ms access.
Teachers Prof. Clark Prof. Brooke Prof. Daniels Time
-
Student_Name Teacher_Namer Subject Time Date James Keith Prof. Clark Math 9:00am 01/05/2004 James Keith Prof. Moore English 10:00am 01/05/2004 James Keith Prof. Smith Art 11:00am 01/05/2004 James Keith Prof. James P.E 1:00pm 01/05/2004 James Keith Prof. Brooke Chem 2:00pm 01/05/2004 James Keith Prof. Daniels Math 3:00pm 01/05/2004 Peter Robertson Prof. Clark Math 8:00am 01/05/2004 Peter Robertson Prof. Moore English 12:00am 01/05/2004 Peter Robertson Prof. Smith Art 4:00pm 01/05/2004 Peter Robertson Prof. James P.E 5:00pm 01/05/2004 Peter Robertson Prof. Brooke Chem 6:00pm 01/05/2004 Peter Robertson Prof. Daniels Math 7:00pm 01/05/2004 Teachers + Prof. Clark + Prof. Brooke + Prof. Daniels +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Time +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8:00 + Peter Robertson + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 9:00 + James Keith + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 10:00 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 11:00 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 12:00 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1:00 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2:00 + + James Keith +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ The list view will be controlled by a date or calendar control. Haven’t decided whether to use a stored procedure. Since I use a select statement with a case argument. Still not getting the look I want. It would be similar to a cross tab table used in ms access.
Teachers Prof. Clark Prof. Brooke Prof. Daniels Time
Hey Ole123 Well I will leave the front end to you, but if you choose to go with a stored proc then here is the basic layout including getting the headers... CREATE PROCEDURE MP_CB_Get_CallBacks AS -- V1.0.0 : Super Winsock : 4 March 2002 -- Returns the Column names and width for the grid. -- It also returns the data. SET NOCOUNT ON --Returns the Column names and it's width. -- 1st is the column name & 2nd is the column width and so on. SELECT 'Id', 0, 'Student_Name', 0, 'Teacher_Name', 2000, 'Subject', 1500, 'Time', 1500, 'Date', 1500 SELECT [Id], Student_Name, Teacher_Name, Subject, Time, Date FROM ?Table SET NOCOUNT OFF GO /* Hope this helps?
-
Hey Ole123 Well I will leave the front end to you, but if you choose to go with a stored proc then here is the basic layout including getting the headers... CREATE PROCEDURE MP_CB_Get_CallBacks AS -- V1.0.0 : Super Winsock : 4 March 2002 -- Returns the Column names and width for the grid. -- It also returns the data. SET NOCOUNT ON --Returns the Column names and it's width. -- 1st is the column name & 2nd is the column width and so on. SELECT 'Id', 0, 'Student_Name', 0, 'Teacher_Name', 2000, 'Subject', 1500, 'Time', 1500, 'Date', 1500 SELECT [Id], Student_Name, Teacher_Name, Subject, Time, Date FROM ?Table SET NOCOUNT OFF GO /* Hope this helps?
-
I forgot to add that the student data is a seperate table as well as the teacher's data. So I have a Student and Teacher table. I don't think I could use a stored procedure.
Well thats no problem?? Just use a JOIN statement to join the teacher and Student tables... This can be done in a sproc. If you really get stuck, just post the Student and Teacher Tables structures and what you want to get out of them in your record set, and I will gladly help you write the sproc. Later Cliff
-
Well thats no problem?? Just use a JOIN statement to join the teacher and Student tables... This can be done in a sproc. If you really get stuck, just post the Student and Teacher Tables structures and what you want to get out of them in your record set, and I will gladly help you write the sproc. Later Cliff
Student_ID | Student_Lname | Student Fname | Subject ID | ---------------------------------------------------------------------- 125 | Mason | Steven | 2 | 100 | Jude | Bob | 2 | 199 | Mason | Mark | 2 | 125 | Mason | Steven | 4 | 225 | Stevenson | John | 2 | 125 | Mason | Steven | 5 | 400 | Madison | Ira | 2 | Teacher_ID | Teacher_Lname | Teacher_Fname | Subject ID | Subject Name| Date | Time| ------------------------------------------------------------------------------------------------------------ 1 | Mason | Steven | 2 | Math | 1/1/2004 | 11:00 am 2 | long | Gary | 2 | English|| 1/1/2004 | 1:00 pm 3 | Clark | James | 2 | P.E| 1/1/2004 | 11:00 am 4 | Simmons | Micheal | 4 | Science| 1/1/2004 | 11:00 pm 5 | Bonnila | Richard | 2 |Art | 1/1/2004 | 11:00 am 6 | Law | Katherine | 5 |Social Studies| 1/1/2004 | 9:00 am 7 | Young | David | 2 | Econ| 1/1/2004 | 8:00 am It should be displayed in the list view as Teachers |Prof. Clark | Prof. Brooke | Prof. Daniels ___________________________________________ Time ____________________________________________ 8:00 | Peter Robertson | Blank|Blank ____________________________________________ 9:00 |James Keith | Blank|Blank ____________________________________________ 10:00| Blank|Blank| Blank ____________________________________________ 11:00| Blank|Blank| Blank ____________________________________________ 12:00| Blank|Blank| Blank ____________________________________________ 1:00| Blank|Blank| Blank ____________________________________________ 2:00 | Blank|Blank| James Keith ____________________________________________
-
Well thats no problem?? Just use a JOIN statement to join the teacher and Student tables... This can be done in a sproc. If you really get stuck, just post the Student and Teacher Tables structures and what you want to get out of them in your record set, and I will gladly help you write the sproc. Later Cliff
Still a little stuck so i still need help. I posted a sample tables in the post and what the display should look like... Thanks for all your help. I have been kicking my self for about two weeks trying to get the display i want with no success. MSSql does not use the Transform sytnax so i'm not able to create the crosstab look and feel for my listview form in vb.net. Thanks again for all your help:)
-
Still a little stuck so i still need help. I posted a sample tables in the post and what the display should look like... Thanks for all your help. I have been kicking my self for about two weeks trying to get the display i want with no success. MSSql does not use the Transform sytnax so i'm not able to create the crosstab look and feel for my listview form in vb.net. Thanks again for all your help:)
Hey Ole Well your post of the tables is somewhat confusing Teachers |Prof. Clark | Prof. Brooke | Prof. Daniels ___________________________________________ Time ____________________________________________ 8:00 | Peter Robertson | Blank|Blank ____________________________________________ 9:00 |James Keith | Blank|Blank etc... 1.Are your headers always going to be the same? If so then you can just hard code them. 2. Just tell me what the headers are and from there I can get the info from the tables. 3. In a listbox you have to use COURIER NEW as your font, else the spacing is never going to be right. 4. You have to pre-determine your column lengths before you populate the listbox. IE: If you have a column named First_Name, thats 10 characters, and the name is Ole. You will have to add 7 spaces after the name to make the next column's data in line with its header. Probably a bit confusing the way I explained but just tell me the column headers and I will write the sproc. Thats the easy part. You will have to do the front end. Later Cliff
-
Hey Ole Well your post of the tables is somewhat confusing Teachers |Prof. Clark | Prof. Brooke | Prof. Daniels ___________________________________________ Time ____________________________________________ 8:00 | Peter Robertson | Blank|Blank ____________________________________________ 9:00 |James Keith | Blank|Blank etc... 1.Are your headers always going to be the same? If so then you can just hard code them. 2. Just tell me what the headers are and from there I can get the info from the tables. 3. In a listbox you have to use COURIER NEW as your font, else the spacing is never going to be right. 4. You have to pre-determine your column lengths before you populate the listbox. IE: If you have a column named First_Name, thats 10 characters, and the name is Ole. You will have to add 7 spaces after the name to make the next column's data in line with its header. Probably a bit confusing the way I explained but just tell me the column headers and I will write the sproc. Thats the easy part. You will have to do the front end. Later Cliff
The columnheader will always change. So it's more of a dynamic columnheader. Depending on the Day of the week. There could be 5 or 3 or 10 teacher who have classes to teacher at different time of the day. The Teacher's name will be the columnheader Basically i'm trying to build a cross-tab query Teaher's names across the top The time is in the left column down and student name Teacher_Name Teacher_Name Teacher_Name Teacher_Name Time Student_Name Student_Name Student_Name Student_Name C1 and R2 = Student_Name C2 and R2 = Student_Name C1 and R3 = Student_Name C1 and R3 = Student_Name and so on The only way i can build a cross-tab query is in crystal report. ;)