I recently want to prepare a report. I started to read it today and found that all the examples provided on the Internet are scattered, and it is not correct to run them all the time. Otherwise, it cannot run. However, I still found a lot of good materials. For example
Http://v.youku.com/v_playlist/f6068270o1p17.html a Demo Video
Http://wenku.baidu.com/view/0d8e92e0524de518964b7d52.html Crystal Reports Quick Start
Basically, I have two parameters, but I also found some problems, that is, I need to enter the database password when reading the data. Later, we found thatCode.
Use crystalreportsource1.reportdocument. setdatabaselogon ("sa", "sa", @ "192.168.1.111", "autolot.
Example:
Webform1.aspx
<% @ Page Language = "C #" autoeventwireup = "true" codebehind = "webform1.aspx. CS "inherits =" crystalwebapp. webform1 "%> <% @ register Assembly =" crystaldecisions. web, version = 10.5.3700.0, culture = neutral, publickeytoken = 692fbea5521e1304 "namespace =" crystaldecisions. web "tagprefix =" cr "%> <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">
Webform. aspx. CS
Using system; using system. collections. generic; using system. LINQ; using system. web; using system. web. ui; using system. web. UI. webcontrols; using crystaldecisions. shared; using crystaldecisions. crystalreports. engine; namespace crystalwebapp {public partial class webform1: system. web. UI. page {protected void page_load (Object sender, eventargs e) {crystalreportsource1.reportdocument. setdatabaselogon ("sa", "sa", @ "192.168.1.111", "autolot ");}}}
Running result