比较简陋的数据库应用,唯一能看的就是对ODBC的封装...

源代码在线查看: table.cpp

软件大小: 15 K
上传用户: haibokaishi2006
关键词: ODBC 比较 数据库 封装
下载地址: 免注册下载 普通下载 VIP

相关代码

				#include 
				#include "Table.h"
				
				#define ROWTITLEWIDTH 3
				#define COLTITLEHEIGHT 1
				
				static String prerow[] ={
					"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13",
					"14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26"
				};
				
				Table::Table(int nrow, int ncol)
				{
					rowNum = nrow;
					colNum = ncol;
					colTitle = NULL;
					rowTitle = NULL;
					gr = NULL;
					colWidth = new int[colNum];
					rowHeight = new int[rowNum];
					curRow = 0;
				}
				
				Table::~Table()
				{
					int i;
					delete [] colWidth;
					delete [] rowHeight;
					for (i = 0; i < rowNum; i++)
					{
						delete [] gr[i];
					}
					delete [] gr;
				
				}
				
				void Table::SetColTitle(const String *str)
				{
					colTitle = str;
					for (int i = 0; i < colNum; i++)
						colWidth[i] = colTitle[i].getlenth();
				}
				
				void Table::SetRowTitle(const String *str)
				{
					rowTitle = str;
					if (rowTitle == NULL)
						rowTitle = prerow;
					for (int i = 0; i < rowNum; i++)
						rowHeight[i] = 2;
				}
				
				void Table::SetTable(Grid** aGr)
				{
					int i, j;
					gr = aGr;
					for (i = 0; i < rowNum; i++)
					{
						for (j = 0; j < colNum; j++)
						{
							if (colWidth[j] < gr[i][j].GetWidth())
								colWidth[j] = gr[i][j].GetWidth();
							if (rowHeight[i] < gr[i][j].GetHeight())
								rowHeight[i] = gr[i][j].GetHeight();
						}
					}
					for (i = 0; i < rowNum; i++)
					{
						for (j = 0; j < colNum; j++)
						{
							gr[i][j].SetHeight(rowHeight[i]);
							gr[i][j].SetWidth(colWidth[j]);
						}
					}
				}
				
				void Table::ShowTable(int page)
				{
					int i, j, k;
					DrawBottom();
					std::cout 					for (i = 0; i < colNum; i++)
						std::cout 					std::cout 					DrawBottom();
					for (i = 0; i < rowNum; i++)
					{
						k = 0;
						std::cout 						while (k < rowHeight[i])
						{
							if (k != 0)
								std::cout 							std::cout 							for (j = 0; j < colNum; j++)
								std::cout m_Info[k] 							std::cout 							k++;
						}
						DrawBottom();
					}
				}
				
				void Table::DrawBottom()
				{
					std::cout 					for (int i = 0; i < colNum; i++)
					{
						std::cout 					}
					std::cout 				}			

相关资源