vs .net sql server login - آموزش برنامه...

21
In_Chan_Nafar Login SQL Server 2005 NET . VS SQL Server NameSpace Connect SQL Server ! " # !$%& () *+ !,& - *+’ #& . * /0 1, 2 . 3 *+’ 4 52 # 62 78 * string reportPath = Server.MapPath("Report1.rpt "); 4 22 # 62 Application.StartupPath * string RepPath=Application.StartupPath + @"\Report\Report1.rpt"; 9’ :; <. 3 =>? 9@" A 1 B 1. C 9 D: Viewer ’ 1 D3 2 4 !,& ! " 22 2 52 # 62 crystalReportViewer.ReportSource *+’ crystalReportViewer.ReportSource = RepPath; *+’ !3B C D: ConnectionInfo !& *#& EB2 ConnectionInfo F 10G; Connection /HB UserID,DataBaseName,Password *+’ 2 4 ConnectionInfo connectionInfo = new ConnectionInfo(); connectionInfo.ServerName = "DynamicMethods"; connectionInfo.DatabaseName = "Db1"; connectionInfo.UserID = "sa"; connectionInfo.Password = "123456";

Upload: hatu

Post on 30-May-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

�����Login�������SQL Server���2005NET .VS��

�� ������������ ����������������������SQL Server�� ������������������������������� �NameSpace�

������������ ��������������� �� ��Connect������������SQL Server����!�� ��"���

� �#�!$%&�����������������������������������������'� �����(���)��������*�+�

��!�,�&������������ ����-��*�+�'� ����������������# �&������ ������ .����� ��

*�������/�0����1��,�2�������� �.���3��*�+�'���

• ��������4������������������ �52� ��#��62��� �78������� �������������������

*��������string reportPath = Server.MapPath("Report1.rpt ");

• ��������4�������������� ��2����2� ��#��62��� ��Application.StartupPath�

*������������ �����

string RepPath=Application.StartupPath + @"\Report\Report1.rpt";�

��

������������������������ �����������9���'������: ;� �<�� .���3�������=>?�� ��9@"�A���1 ����

����� B����������������1���� .��C� �� �9��� ��D�:����Viewer����������� ����� �'�����1������D���3��

������������ �����������

• �����������2����������4������!��,�&�����!� ��"����2���2�2�52� �#��62�� �

crystalReportViewer.ReportSource��������*�+�'� ������

crystalReportViewer.ReportSource = RepPath;�

��

�����*����+�'�������!����3B�C���� ���D����:ConnectionInfo��!���& ��*�# ����&����E���B 2��

ConnectionInfo���������������F�������������1����������0G; �Connection���/����������HB��

UserID,DataBaseName,Password����������*�+�'� ������������2����������4��

ConnectionInfo connectionInfo = new ConnectionInfo();

connectionInfo.ServerName = "DynamicMethods";

connectionInfo.DatabaseName = "Db1";

connectionInfo.UserID = "sa";

connectionInfo.Password = "123456";

Page 2: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

������ �9��� ��D�:ConnectionInfo��������crystalReportViewer�������������� �����E���'�� �

*�����������������2����������4��

private void SetLogin(ConnectionInfo connectionInfo)

{

TableLogOnInfos TbLogOnInfos = crystalReportViewer.LogOnInfo;

foreach (TableLogOnInfo TbLogOnInfos in TbLogOnInfos)

{

TbLogOnInfos.ConnectionInfo = connectionInfo;

}

}

�2���2��62��I�� ��J��8�������7���C#�*�� 4��ConnectionInfo connectionInfo = new ConnectionInfo();

connectionInfo.ServerName = "DynamicMethods";

connectionInfo.DatabaseName = "Db1";

connectionInfo.UserID = "sa";

connectionInfo.Password = "123456";

string RepPath=Application.StartupPath + @"\Report\Report1.rpt";�

crystalReportViewer.ReportSource = RepPath;

SetLogin(connectionInfo); ----------------------------------------------------------------------

private void SetLogin(ConnectionInfo connectionInfo)

{

TableLogOnInfos TbLogOnInfos = crystalReportViewer.LogOnInfo;

foreach (TableLogOnInfo TbLogOnInfos in TbLogOnInfos)

{

TbLogOnInfos.ConnectionInfo = connectionInfo;

}

}

��� ��A���1 ����Page_Load��#�� B�����

��62��I�� �528�������7���C#��*�� 4��ConnectionInfo connectionInfo = new ConnectionInfo();

connectionInfo.ServerName = "DynamicMethods";

connectionInfo.DatabaseName = "Db1";

connectionInfo.UserID = "sa";

connectionInfo.Password = "123456";

string reportPath = Server.MapPath("Report1.rpt");

crystalReportViewer.ReportSource = RepPath;

SetLogin(connectionInfo); ----------------------------------------------------------------------

private void SetLogin(ConnectionInfo connectionInfo)

{

TableLogOnInfos TbLogOnInfos = crystalReportViewer.LogOnInfo;

foreach (TableLogOnInfo TbLogOnInfos in TbLogOnInfos)

{

TbLogOnInfos.ConnectionInfo = connectionInfo;

}

}

��� ��A���1 ����Page_Init��#�� B����

��

��

Page 3: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

�����Login�������SQL Server���$����SQL Authentication��

�������� �/K�3��� ������ ��������!�3B�C� ��SQL Server��� ����# �&�L������ ������ .����

������M��� ���+���C� � �ReportDocument�����*�# �&������ ���������������������D2��N�I������

��$���������� �OP��I��*�������/%��SQL Server���� �������������&���D2�N��Q� ��

�!�,�&�� ���� �'��������� �OP��C� �D���ConnectionInfo������������ ����

��

�M��R�S'� �ReportDocument*�������/�0����1��,����4��ReportDocument RepDoc=new ReportDocument();��

��

*�������/�0����1��,�2�������� �.���3��*�+�'� ����

• ��������4������������������ �52� ��#��62��� �78������� �������������������

*��������string reportPath = Server.MapPath("Report1.rpt");

• ��������4�������������� ��2����2� ��#��62��� ��Application.StartupPath�

����� *������������

string RepPath=Application.StartupPath + @"\Report\Report1.rpt";�

��

������������������������ �����������9���'������: ;� �<�� .���3�������=>?�� ��9@"�A���1 ����

������� ��D�:�������� B�������������1���� .��C� �� �9Viewer����������� ����� �'�����1������D���3��

������� ������������������������M��� �����C� � ��ReportDocument�������*� �����T� ���� ��

*�������������� � RepDoc.Load(RepPath);

�M��D�:ReportDocument���� ��Viewer�*�#����9���1�����D��3�����crystalReportViewer.ReportSource = RepDoc;��

��

�� �� ��S����1���+�'�D��0ConnectionInfo����������������E���'�����C�������������� �O�U�'��$HB�!�3B������

SetLogin*�� ���������private void SetLogin(ConnectionInfo connectionInfo,ReportDocument reportdocument)

{

Tables tables = reportdocument.Database.Tables;

foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)

{

TableLogOnInfo TbLogonInfo = table.LogOnInfo;

TbLogonInfo.ConnectionInfo = connectionInfo;

table.ApplyLogOnInfo(TbLogonInfo);

} }

Page 4: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

��2���2��62��I�� ��J�8�������7���C#*�� �4��ConnectionInfo connectionInfo = new ConnectionInfo();

ReportDocument RepDoc=new ReportDocument();��connectionInfo.ServerName = "DynamicMethods";

connectionInfo.DatabaseName = "Db1";

connectionInfo.UserID = "sa";

connectionInfo.Password = "123456";

string RepPath=Application.StartupPath + @"\Report\Report1.rpt";�

RepDoc.Load(RepPath);�

crystalReportViewer.ReportSource = RepDoc;

SetLogin(connectionInfo, RepDoc); ----------------------------------------------------------------------

private void SetLogin(ConnectionInfo connectionInfo,ReportDocument

reportdocument)

{

Tables tables = reportdocument.Database.Tables;

foreach (CrystalDecisions.CrystalReports.Engine.Table table in

tables)

{

TableLogOnInfo TbLogonInfo = table.LogOnInfo;

TbLogonInfo.ConnectionInfo = connectionInfo;

table.ApplyLogOnInfo(TbLogonInfo);

}

}

��

52��62��I�� �8�������7���C#��*�� 4��ConnectionInfo connectionInfo = new ConnectionInfo();

ReportDocument RepDoc=new ReportDocument();��connectionInfo.ServerName = "DynamicMethods";

connectionInfo.DatabaseName = "Db1";

connectionInfo.UserID = "sa";

connectionInfo.Password = "123456";

string reportPath = Server.MapPath("Report1.rpt");�

RepDoc.Load(RepPath);�

crystalReportViewer.ReportSource = RepDoc;

SetLogin(connectionInfo, RepDoc); ----------------------------------------------------------------------

private void SetLogin(ConnectionInfo connectionInfo,ReportDocument

reportdocument)

{

Tables tables = reportdocument.Database.Tables;

foreach (CrystalDecisions.CrystalReports.Engine.Table table in

tables)

{

TableLogOnInfo TbLogonInfo = table.LogOnInfo;

TbLogonInfo.ConnectionInfo = connectionInfo;

table.ApplyLogOnInfo(TbLogonInfo);

}

}

��

��

��

Page 5: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

�#�� �����������������

� �#�� �������������� ���$�����1�����D��3��VS.NET�/�0����1��V������3����

�������8'��$HB� �#�W���Q����#�� �����������$��1��,������HX *� �OHU��7��

��$�����1�����D��3��� �#�� ���������@��D��� � �VS.NET�������� ����!� ��"���

������������ ���ReportDocument RepDoc = new ReportDocument();

string RepPath = Application.StartupPath + "\\CrystalReport1.rpt";

RepDoc.Load(RepPath);

crystalReportViewer1.ReportSource = RepDoc;

//-------------------------------------------

ParameterValues parameterValues = new ParameterValues();

ParameterDiscreteValue parameterDiscreteValue = new

ParameterDiscreteValue();

parameterDiscreteValue.Value = "ParameterValue";

parameterValues.Add(parameterDiscreteValue);

ParameterFieldDefinitions parameterFieldDefinitions =

RepDoc.DataDefinition.ParameterFields;

ParameterFieldDefinition parameterFieldDefinition =

parameterFieldDefinitions["ParameterName"];

parameterFieldDefinition.ApplyCurrentValues(parameterValues);

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

Page 6: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

��$�����W� .�����#�� ����2���Selection Formula

������������������W� .������# �&����������D��Y�� ���Z����������[��&��2�����I��� � �1���� .���?��

������ �?�����F������&� �#�����"X8����� �?����X����0����������������7���� ����������� � �

�9��'�����C� �2����2�������������W� .����+���C� Selection Formula������\�T� ����

������������ ����1 ������ �A���W� .��!&��� ����ReportDocument RepDoc = new ReportDocument();

string RepPath = Application.StartupPath + "\\CrystalReport1.rpt";

RepDoc.Load(RepPath);

string SFormula= "{Customer.Code}=1050";

RepDoc.DataDefinition.RecordSelectionFormula = SFormula;

crystalReportViewer1.ReportSource = RepDoc;

��

��

����� �D�:�]���� � �?�String������4��

��ReportDocument RepDoc = new ReportDocument();

string RepPath = Application.StartupPath + "\\CrystalReport1.rpt";

RepDoc.Load(RepPath);

string SFormula= "{Customer.Code}='1050'";

RepDoc.DataDefinition.RecordSelectionFormula = SFormula;

crystalReportViewer1.ReportSource = RepDoc;

��

��� ��D��� ���� �'�������������� �#�� Select Expert���������� �1������D���3����&��

���-���?�������� � ��������X�'� �#�������#����2���������

��

��

��

��

��

��

��

��

��

��

Page 7: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

�����Connect��������SubReport�#���

�9��'�����'��� .���?����Crystal Report����L���EB ����^S�����������: ;�

�Q�� �����SubReport������������� ��#��'��_����I���� ��1��� .�������� ��)��)��X2

������������� N ���SubReport����� �DataBase��������/%�����

��

��#�\�T� � �����/: �����!� ��"�����-�� � ����

�� ConnectionInfo������*�+�'� ��

ConnectionInfo connectionInfo = new ConnectionInfo();

connectionInfo.ServerName = ".";

connectionInfo.DatabaseName = "anbar";

connectionInfo.UserID = "sa";

connectionInfo.Password = "123456";

�� *�������=>?�� ��W� .���3�

ReportDocument RepDoc = new ReportDocument();

string RepPath = Application.StartupPath + "\\CrystalReport1.rpt";

RepDoc.Load(RepPath);

�� � �Report�E��'�I���$, �Login*�3���������private void SetLoginMainReport(ConnectionInfo connectionInfo,

ReportDocument reportdocument)

{

Tables tables = reportdocument.Database.Tables;

foreach (CrystalDecisions.CrystalReports.Engine.Table table

in tables)

{

TableLogOnInfo TbLogonInfo = table.LogOnInfo;

TbLogonInfo.ConnectionInfo = connectionInfo;

table.ApplyLogOnInfo(TbLogonInfo);

}

}

��

��

��

��

��

��

��

��

Page 8: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

�� � �� ������C��#�D�:SubReport*�#����\�T� ��

private void SetLoginSubReport(ConnectionInfo connectionInfo,

ReportDocument reportdocument)

{ Sections sections = reportdocument.ReportDefinition.Sections;

foreach (Section section in sections)

{

ReportObjects RepObjs = section.ReportObjects;

foreach (ReportObject RepObj in RepObjs)

{ if (RepObj.Kind ==ReportObjectKind.SubreportObject)

{ SubreportObject SubreportObj = (SubreportObject)RepObj;

ReportDocument SubReportDoc = SubreportObj.OpenSubreport(SubreportObj.SubreportName);

SetLoginMainReport(connectionInfo, SubReportDoc);

}

}

}

}

��

�� ����1��,����/������ �& "�C� �*��������� �& "� ������������E��'�2�D�:

!� �

ConnectionInfo connectionInfo = new ConnectionInfo();

connectionInfo.ServerName = ".";

connectionInfo.DatabaseName = "anbar";

connectionInfo.UserID = "sa";

connectionInfo.Password = "123456";

ReportDocument RepDoc = new ReportDocument();

string RepPath = Application.StartupPath + "\\CrystalReport1.rpt";

RepDoc.Load(RepPath);

SetLoginMainReport(connectionInfo, RepDoc);

SetLoginSubReport(connectionInfo,RepDoc);

crystalReportViewer1.ReportSource=RepDoc;

��

��

��

��

��

��

��

��

��

��

Page 9: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

�����D�%' ��W� .����DataSet

��������� .��D�%' ������)����!�3B�C� ��DataSet�9��'�����C� ����X ������# �&����Q�

DataSet Schema����# �&�\�T� ���������� �������@�3��1��� .�DataBase�����/%���

�9��'�����C� �2���Schema������\�T� ��� ��1��� .�������� ������������� ��N�'�

�M��� ���������������#��62�DataSet��������������� �����

�I��]2�� �Connection�]���� �DataSet Schema���-�� � ��!&���*�# �&���

�� � 2���Server Explorer����.��2������I�$��!� ��Add Connection� ��

�������5�>�� �

��

��

��

��

��

��

��

��

�� ��#�\�T� � ���;����1���+�'�J_��

��

��

��

��

��

��

��

Page 10: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

�� ����62�� 2����D�:Solution Explorer�� ����� �2������!� ��I�$�Add����.��

New Item�5�>�� � ����2���2� �#��62�� ���;����\"�� �2DataSet�2�5�>�� � ��

�52� �#��`2�� �XML Schema��5�>�� � ���������

��

��

��

��

��

��

��

��

��

�� �!�3B�� �D�:Solution Explore� 2����2��������5�>�� � ���;����D2�N�

Dataset1.xsd��������#���

��

��

��

��

��

��

��

��

��

��

��

Page 11: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

�� ����62�� 2����D�:Solution Explorer�� ����� �2������!� ��I�$�Add���.���

New Item��;����\"�� �2�5�>�� � ��Crystal Report�������5�>�� � ���

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

�� �� ������ �������/-�������#Wizard��$����� ����� .��Schema!&���*�# �&��

��

����

��

��

��

��

��

��

��

��

��

��

��

��

��

��

� �\"��Standard Report Creation Wizard�� ��!�3BAvailable Data

Source�,��������1�tree� �Z��������

�Project Data-> ADO.NET DataSet -> YourDataSetName-> Your Table Name������� �'���������S�����,�����������#�?�� ���;����\"���%'���

��

Page 12: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

��

��

��

��

��

��

��

��

��

��

� � 2��Next���������#�?��.��� �� �S�� �#�\"��'��������I�$������������'� ��/: �

���Finish ������������#�?���&���� �'��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

Page 13: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

�� ������������ ��62���� ���;�������J_��

string ConStr = "Data Source=.;Initial Catalog=Anbar;User

ID=sa;Password=123456";

SqlConnection SQLCon = new SqlConnection(ConStr);

SqlDataAdapter SQLAdapter = new SqlDataAdapter("SELECT * FROM

TbPersonal", SQLCon);

DataSet1 dataset = new DataSet1();

SQLAdapter.Fill(dataset, "TbPersonal");

//------------------------------------------------

ConnectionInfo connectionInfo = new ConnectionInfo();

ReportDocument RepDoc = new ReportDocument();

connectionInfo.ServerName = ".";

connectionInfo.DatabaseName = "anbar";

connectionInfo.UserID = "sa";

connectionInfo.Password = "123456";

string RepPath = Application.StartupPath + @"\CrystalReport1.rpt";

RepDoc.Load(RepPath);

RepDoc.SetDataSource(dataset);

crystalReportViewer1.ReportSource = RepDoc;

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

Page 14: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

����W� .��D�%' �����DataReaderI� �

������� �#��62���?�����I���2��.NET����M��� �DataReader���������� ����������������� �a�' �����

�������� ��?���a' ������Q�!0�DataSet�������������������� ���������P���#���M��DataReader����&�

���� �.��IDataReader8�IDataReader����I���&�Interface�������������7���������������������� ��������C��

��3����������� ��������*�# �&����!�3BMulti Tier�������������+���C� � ��*��������� �

Solution Explorer�]������ �D2 ��62���������������������T� ��62����2�����������&�Windows

Application �]������ �\2��62����2�Class Libarary����������������\2��62������J_����

8Class Libarary7� �� ��������Calss1.cs��3��������private const string ConStr = "Data Source=.;Initial

Catalog=Anbar;User ID=sa;Password=123456";

public static IDataReader GetTbPersonal()

{

SqlConnection SQLCon = new SqlConnection(ConStr);

SQLCon.Open();

SqlCommand SQLCommand = new SqlCommand("SELECT * FROM

TbPersonal", SQLCon);

IDataReader iDataR = SQLCommand.ExecuteReader();

return iDataR;

}

�� �\2��62���� 2�����8Class Libarary�7������.��2��������!��� ��I���$�Build� ��

��������5�>�� ����������������������#�?��� �Build������I��������DLL�����!�� ��������&������

��3�DLL��T���� � ��Output�����_3��;�&����8������_����S��7

�� �����D2 ��62��� 2��8Application7 ����������!�� ��I��$���I���2�*���QCrystal

Report�������5�>�� � ���

�� �� ������ �������/-�������#Wizard!&���*�# �&� ��W� .�����

��

��

��

��

��

��

��

��

Page 15: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

�� �\��"��Standard Report Creation Wizard�!���3B�� �Available Data

Source��1��,������tree�Z��������Node�����C�&�������F�Connection �������N

�������5�>�� � �� Create New Connection -> ADO.NET

��

��

��

��

��

��

��

��

��

��

��

��

�� �\"�� �D�:ADO.NET�/��"�DLL�������5�>�� � ���

��

��

��

��

��

��

��

��

��

��

��

��

Page 16: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

�� ���$�� 2���Finish�������/�0������%'������#�2������I�$���

��

� ���������������#�?�����/-���������������������� ��� ��*� ���� �&����������#�$�"�1��,��)���������

�� Class!� ������b >�� ��

SqlCommand SQLCommand = new SqlCommand("SELECT * FROM TbPersonal", SQLCon);

������!� ��N >�� � �#�$�"� �S'������������� �A���9&�EB 2���c8���S�ALL�7����(���)�D�:

�����1��,�����������SqlCommand SQLCommand = new SqlCommand("SELECT ID,Name FROM TbPersonal", SQLCon);

��$�"�2�9@"ID,Name�#����L�������� �� �����

��

��

��

��

��

��

��

Page 17: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

� ���D2 ��62��� ��� ��������D�:8Application7 ��������� .����'����3������� �L������

���

string RepPath = Application.StartupPath + "\\CrystalReport1.rpt";

ReportDocument RepDoc = new ReportDocument();

RepDoc.Load(RepPath);

crystalReportViewer1.ReportSource = RepDoc;

��

������������ �������������� ����������� ����������������������

�!��"#����� ��������� �����$% ��&����� ������� ����'"�������� �� ��(�)�*�

�"�����

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

��

Page 18: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

��� �2�Merge Module� �#�Crystal Reports� �

������������&������� ����# �&����������������Setup������ ���(���)������������<'�CR������������� �

��� ������������Merge Module���������������� ��>�3�� ��#�CR������ ��*���������� �2���D��:�

��!� �*�# �& Merge Module�R$�>�� �#��>3�� �#�CR������^S�������������� ��N�'

�� Merge Module�����&�!������ ������ ������^S��2�������a%��I�'���' �1��,����

Business Object�������!"����� ��

��

�� Crystal Reports 9.0

��

��

��

��

��

��

��

��

��

��

��

��

�� Crystal Reports 10.0

��

��

��

��

��

��

��

��

��

��

Page 19: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

�� Crystal Reports 11.0

��

��

��

��

��

��

��

��

��

�� CR For VS.NET 2002

��

��

��

��

��

�� CR For VS.NET 2003

��

��

��

��

��

��

��

��

����d�Q�����?���1�0G; �a3�� ���������SN �4��http://support.businessobjects.com/downloads/merge_modules.asp

Page 20: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

��� �2�Crystal Reports Developer Edtion��

�����������'��8���!3#��A �*���-"�7���������������������e �f�:�H��� ���-��� ��>X�1���� .���: ;�f��

���������������������� �����-� �C�� ������������� �������#� �����H���������!���������X2���� ����W� .�� �#

���� �� ���������*# "�� �4��

�� !3������Q�� ���������Q�W���Q2�������g��X�� !� ����.#������3���

�� �������!3���� �>X� ���� .��h��3��������#8�����������C�� �h���3��i�.��� ��#� ." �\���9@"

���-� ���3#�7

�� !� ����B2��Q� ��������"�

�� �����A������3�� ���62��!��B�

�� �2���

����'����������J�������+���� ������a� �N����

����>�3��� ������Crystal Reports XI Developer Edition R2���������������2�������������N���

���������<'���������.����Q��>3��C�&Q�����>3��C� ���� �'���

� �������"S���>3�.NET�.����������������� �B������� ������2�Merge Module���Q� ��#�

� �.NET'��H0��� ���4��CrystalReports11_maps.msm

CrystalReports11_RDC_Designtime.msm

CrystalReports11_RDC_License.msm

CrystalReports11_RDC_Reportengine.msm

CrystalReports11_RDC_Runtime.msm���

�?��W�� "�A���1�-�����\� 2��� �����

��

��

��

��

��

��

��

��

��

��

��

��

��

��

Page 21: VS .NET SQL Server Login - آموزش برنامه نویسیdl.sourcebaran.com/download/212/CrsystalReports.NET… ·  · 2012-05-05SQL Authentication $ˇ˛ SQL Server Login ˜

������������ ����������������In_Chan_Nafar����� �� �� �� �

���������� ���� ���

����������� ���������������������� ���������������������� ���������������������� ������������ �� �� �� �

� �� �� �� �

������������������������������ ��!���� "#�$���%&������������������� ��!���� "#�$���%&������������������� ��!���� "#�$���%&������������������� ��!���� "#�$���%&���'���()���#��� ��*�������#�+, ��'���()���#��� ��*�������#�+, ��'���()���#��� ��*�������#�+, ��'���()���#��� ��*�������#�+, �Doc�#������������#������������#������������#������������ �� �� �� �

�'��- ��( ��'��- ��( ��'��- ��( ��'��- ��( �Doc.����/�!������#�������0���1(/���� "#�������23�������4"������.����/�!������#�������0���1(/���� "#�������23�������4"������.����/�!������#�������0���1(/���� "#�������23�������4"������.����/�!������#�������0���1(/���� "#�������23�������4"������5555� �� �� �� �

�#�� ��#���*�#�� ��#���*�#�� ��#���*�#�� ��#���*In_Chan_Nafar6�6�6�6�� �� �� �� �

$��- �����7(%,���"�!�'�$��- �����7(%,���"�!�'�$��- �����7(%,���"�!�'�$��- �����7(%,���"�!�'�� �� �� �� �

� �89) �89) �89) �89) �������#�+, �������#�+, �������#�+, �������#�+,

� �����������������������������������������:&��#�:&��#�:&��#�:&��#����

� ���������������������������������������������:&��#�:&��#�:&��#�:&��#����

� ������(: ������(: ������(: ������(: ���������:&��#�:&��#�:&��#�:&��#����

� �$��:4�$��:4�$��:4�$��:4�55�55�55�55���;���;���;���;���������:&��#�:&��#�:&��#�:&��#����

� �89) �89) �89) �89) ���+<�',= ���+<�',= ���+<�',= ���+<�',=

� �� �� �� �

���>? �#�� ��#����� ���>? �#�� ��#����� ���>? �#�� ��#����� ���>? �#�� ��#����� � �� �� �� �

�1(@�����A�@"� �1(@�����A�@"� �1(@�����A�@"� �1(@�����A�@"� 6666RUP � �� �� �� �

�$� ��/��B%����$�$� ��/��B%����$�$� ��/��B%����$�$� ��/��B%����$ :����UML

��,���� �����>? ��,���� �����>? ��,���� �����>? ��,���� �����>? �6�6�6�6Multi tier – XP� �� �� �� �

��,���� ��������$��,���� ��������$��,���� ��������$��,���� ��������$�6�6�6�6C# , VB.NET

��#�#���C�;��#�#���C�;��#�#���C�;��#�#���C�;�6�6�6�6SQL Server 2005 "�"�"�"�555555555555� �� �� �� �

D��1!D��1!D��1!D��1!�6�6�6�6Crystal Reports

����E@#��$� �D��1!����E@#��$� �D��1!����E@#��$� �D��1!����E@#��$� �D��1!�6�6�6�6- ��4�#�F��G��#- ��4�#�F��G��#- ��4�#�F��G��#- ��4�#�F��G��#� �� �� �� �

""""555555555555� �� �� �� �

H,���� ���� �"�H��"��D$� ��'��I"#�-�,��H�,�����!�H,���� ���� �"�H��"��D$� ��'��I"#�-�,��H�,�����!�H,���� ���� �"�H��"��D$� ��'��I"#�-�,��H�,�����!�H,���� ���� �"�H��"��D$� ��'��I"#�-�,��H�,�����!�5555

� �� �� �� �

���������(����J�� �(����J�� �(����J�� �(����J�� � �� �� �� �

� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� ����������������������������� �� �� �� �