【问题标题】:Error CS0103 FastReport.net错误 CS0103 FastReport.net
【发布时间】:2016-10-13 04:39:10
【问题描述】:

我是 C#.net Windows 窗体开发人员。 我正在使用 FastReport.net。但有一些错误。

这是我的代码:

DataSet ds = new DataSet();
SqlConnection cnn = new SqlConnection("MyCnnStr");
SqlCommand cmd = new SqlCommand();
cmd.Connection = cnn;
cmd.CommandText = "select * from test";
cmd.CommandType = CommandType.Text;
SqlDataAdapter dap = new SqlDataAdapter(cmd);
dap.Fill(ds, "ds");
report1.RegisterData(ds.Tables[0],"ds");
report1.GetDataSource("ds").Enabled = true;
report1.Load("Untitled.frx");
report1.Show();

但我的错误:

我怎么了?

【问题讨论】:

  • 您在哪里定义了这些nametelfax
  • 我解决了这个问题。非常感谢
  • @MiladCoder,你能分享一下你是如何解决这个问题的吗?
  • 我也有同样的问题,请问你是怎么解决的

标签: c# dataset fastreport


【解决方案1】:

如果name、tel和fax是表名,那么你可以尝试写如下:

DataSet ds = new DataSet();
SqlConnection cnn = new SqlConnection("MyCnnStr");
SqlCommand cmd = new SqlCommand();
cmd.Connection = cnn;
cmd.CommandText = "select * from test";
cmd.CommandType = CommandType.Text;
SqlDataAdapter dap = new SqlDataAdapter(cmd);
dap.Fill(ds, "ds");
report1.RegisterData(ds.Tables[0],"ds");
report1.GetDataSource("ds").Enabled = true;
report1.GetDataSource("name").Enabled = true; // add this part
report1.GetDataSource("tel").Enabled = true;  //
report1.GetDataSource("fax").Enabled = true;  //
report1.Load("Untitled.frx");
report1.Show();

您也可以尝试在设计器模式下删除连接。

【讨论】:

    【解决方案2】:

    CS0103如果你随便从其他键盘布局打印符号可能会出现。

    例如:E(英语)、Е(俄语)、Ε(希腊语)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-05
      • 2022-01-25
      • 1970-01-01
      • 2016-04-24
      相关资源
      最近更新 更多