c# - 我正在尝试使用 Visual Studio 2017 中的 Crystalreport 从数据库集中打印标签
问题描述
我正在尝试在 Visual Studio 2017 中创建一个标签应用程序,该应用程序使用数据库集来存储数据并同时以标签的形式打印这些数据。
但是,我无法将数据从数据库获取到标签。例如,当我点击“打印”按钮时,它会提示您输入您的采购订单号,然后点击确定;然后它会显示一个窗口,其中包含所有字段的名称但没有数据。
这是我的“打印”按钮的C#:
private void print_Click(object sender, EventArgs e)
{
DataSet ds = new DataSet();
DataTable dtd = new DataTable();
dtd.Columns.Add("Your P.O #", typeof(string));
dtd.Columns.Add("Your Job #", typeof(string));
dtd.Columns.Add("Title", typeof(string));
dtd.Columns.Add("Quantity in the Box", typeof(string));
dtd.Columns.Add("Box", typeof(string));
dtd.Columns.Add("of", typeof(string));
foreach (DataGridViewRow dtgv in dtgv.Rows)
{
dtd.Rows.Add(dtgv.Cells[1].Value, dtgv.Cells[2].Value, dtgv.Cells[3].Value, dtgv.Cells[4].Value, dtgv.Cells[5].Value, dtgv.Cells[6].Value);
}
ds.Tables.Add(dtd);
ds.WriteXmlSchema("sticker.mdf");
prtsticker fm = new prtsticker();
stickerprint cr = new stickerprint();
cr.SetDataSource(ds);
fm.Show();
}
解决方案
推荐阅读
- sql - sql查询获取双周数据
- javascript - 如何停止在手机的文本框中输入字符?
- c# - Office 加载项 VSTO 任务窗格
- python - 用于将电子邮件与选定域匹配的正则表达式
- git - 我们可以删除在测试执行期间创建的更改(git 更改)而不是仅合并/放弃它们吗?
- ios - 由于在 WiFi 上运行 iOS 12.2 的 iPhone 和 iPad 崩溃,Apple 拒绝了我的应用
- python - 如何找到 RDD 的 MIN 和 MAX
- sql - 在 Rails 中递归获取记录
- c++ - 进程 rc 无法启动
- javascript - 启动 npm 时使用 log4js appender 调试错误