0

好的,所以我父亲的业务有大约 400 名客户,并且他有一份客户列表,他的业务进展缓慢,所以他决定花 2 天时间将每个客户的姓名输入以下格式:

  • 名字和姓氏
  • 地址和邮政编码

成一张大纸,然后打印。

我正在开发一个程序,该程序将他的所有客户从 mysql 数据库加载到它加载的 datagridview 中,并加载到 ID、First、Last、Phone、Address 和 Zip-code 中。

所以我的问题是,我如何能够选择一个 ID 号或多个 ID 号将其转换为 Richtextbox,以便他可以复制它甚至从那里打印它?

4

2 回答 2

1

You'll need to run a query. My recommendation is to use pdo.

The query should look something like this.

 SELECT * FROM `customers` (you could add a WHERE clause also e.g. WHERE id = 1)

Next you need to grab the results from that query. You should use fetch.

Once you have the results. You could make a while loop and feet the results into a table, textarea, or anywhere!

Now you know how you can do it. :) Hope this helped.

于 2012-09-15T21:02:06.467 回答
1

我建议您使用PDO获取数据,然后使用PHPExcel将其存储在电子表格中。

查询将类似于:

SELECT * FROM `customers` ORDER BY `customer_name`

如果一个客户有多行,您还可以使用:

SELECT * FROM `customers` ORDER BY `customer_name` GROUP BY `customer_name`
于 2012-09-16T21:44:01.827 回答