dont start banging ur head if u r getting any error while creating pdf file crystal report.. go thru these steps..
1) in ur visual studio .net right click on solution expl of ur project and add an .xsd file. this is for creating a new schema that u need for the report,,
2)in ur schema file that is ur xsd file select what ever database files u want from the server explorer that u find on the right side. this will create a new shema which u can use as a source in ur report..
3) add a report in to ur porject and then in the database expert .. select more data source..then select ado.net(xml) ,, .. now xml file path will be asked select the xsd file that u just created,, now add the newdataset which just got created to the right list box by clicking on the > button
4) now from the field explr select the fileds into the report
5) now time for some coding,,
if u r writing the code in some button click include this
private void Button1_Click(object sender, System.EventArgs e)
{
string tableName = "TEST_HARISH"; string rptFile = "PDFTest.rpt";
string xsdFile = "PDFTest.xsd";
string pdfFile = "MailPDF.pdf";
DataTable dat_tblPDF = new DataTable();
dat_tblPDF = GetTable();
dat_tblPDF.TableName = tableName;
DataSet dat_setPDF = new DataSet();
dat_setPDF.Tables.Add(dat_tblPDF.Copy());
CreateShemaFile(xsdFile, dat_setPDF);
// Report document
ReportDocument rpt_docPDF = new ReportDocument();
string strFileNameRPT = Server.MapPath(rptFile);
rpt_docPDF.Load(strFileNameRPT);
rpt_docPDF.ReportOptions.EnableSaveDataWithReport = false;
rpt_docPDF.SetDataSource(dat_setPDF);
ExportOptions exp_optPDF = rpt_docPDF.ExportOptions;
exp_optPDF.ExportFormatType = ExportFormatType.PortableDocFormat;
exp_optPDF.ExportDestinationType = ExportDestinationType.DiskFile;
exp_optPDF.DestinationOptions = new DiskFileDestinationOptions();
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
((DiskFileDestinationOptions)
// u can give the full path or u can use map path to find the full path
rpt_docPDF.ExportOptions.DestinationOptions).DiskFileName = @"D:\PDF_File\MailPDF.pdf";
rpt_docPDF.Export();
mail();
Response.Write("<a href=\"" + @"D:\PDF_File\MailPDF.pdf" + "\">" + pdfFile + "</a>");
}
/*now include these function assuming that u r taking the data form a db and then putting it into a xsd and then tranfer to a report then convert it into a pdf format... please change the database name and stuffs like that according to ur project*/
private DataTable GetTable()
{
DataTable dat_tblPDF = new DataTable("TEST_HARISH");
SqlConnection con = new SqlConnection("Coonection string over here");
SqlDataAdapter sql_datadpPDF = new SqlDataAdapter("SELECT MAN_NO, PART_NO, NAME FROM TEST_HARISHWITH (NOLOCK)" ,con  

;
DataSet dat_set = new DataSet();
sql_datadpPDF.Fill(dat_set, "TEST_HARISH");
return dat_set.Tables["TEST_HARISH"];
}
private void CreateShemaFile(string strFileNameXSD, DataSet dat_setPDF)
{
string strServerFilePath = Server.MapPath(strFileNameXSD);
FileStream myFileStream = new FileStream (strServerFilePath, FileMode.Create);
XmlTextWriter myXmlWriter = new XmlTextWriter(myFileStream, Encoding.Unicode);
dat_setPDF.WriteXml( myXmlWriter, XmlWriteMode.WriteSchema );
myXmlWriter.Close();
}
if u have anymore doubts please be free to mail me ,,, harishjan@india.com