当前位置: 首页 > 工具软件 > crystal-mysql > 使用案例 >

mysql,crystal report

陈修诚
2023-12-01
            OdbcConnection conn;
 
            string connStr = "DRIVER={MySQL ODBC 3.51 Driver};" +                             "SERVER=localhost;" +                             "DATABASE=report;" +                             "UID=root;" +                             "PASSWORD=7200581;" +                             "OPTION=3";             conn = new OdbcConnection(connStr);             conn.Open();
 
            report = new CrystalReport1();             OdbcCommand cmd = conn.CreateCommand();             //cmd.CommandText = "select * from wendu where id = 1";             cmd.CommandText = query;             OdbcDataAdapter da = new OdbcDataAdapter();             da.SelectCommand = cmd;             DataSet ds = new DataSet();             da.Fill(ds, "wendu");             report.SetDataSource(ds);             crystalReportViewer1.ReportSource = report;             //move             conn.Close();
 类似资料: