Click here to Skip to main content
15,881,092 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is aspx code

XML
<form id="form1" runat="server">
       <div style="left:250px;position:relative ;">

           <CR:CrystalReportViewer ID="CrystalReportViewer1"  runat="server" AutoDataBind="True" GroupTreeImagesFolderUrl="" Height="1202px" ToolbarImagesFolderUrl="" ToolPanelWidth="200px" Width="1888px" />
       </div >
        <div style="position:absolute ;  left: 0px;  height: 233px; width: 19%; top: -45px;">


                <br />

                <br />


                <br />
                <table class="auto-style1">
                    <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td><strong>CustomerName</strong></td>
                        <td> </td>
                    </tr>
                    <tr>
                        <td>
<dx:ASPxComboBox ID="ASPxComboBox1" runat="server" Height="34px" ValueType="System.String" Width="231px">
                </dx:ASPxComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td> <dx:ASPxButton ID="ASPxButton1" runat="server" Text="PrintReport">
                </dx:ASPxButton></td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                </table>

        </div>
    </form>



this is my vb.net

Partial Class Default2
Inherits System.Web.UI.Page
Dim con As New SqlConnection()
Dim reader As SqlDataReader
Dim cmd As New SqlCommand()


Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim constring As String = ConfigurationManager.ConnectionStrings("mycon").ConnectionString
con.ConnectionString = constring
con.Open()
ASPxComboBox1.Items.Clear()
cmd.CommandText = "Select cmpname From cus_analysis1"
cmd.Connection = con
reader = cmd.ExecuteReader()

While (reader.Read())
ASPxComboBox1.Items.Add(reader(0))
End While
reader.Close()








End Sub
Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo, ByVal myReportDocument As ReportDocument)

' The tables that display data in the report
Dim myTables As Tables = myReportDocument.Database.Tables
' The login information used to connect to the database
Dim myTableLogonInfo As TableLogOnInfo ' Loop through each of the tables found
For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables
' Set the login information used to connect to the database
myTableLogonInfo = myTable.LogOnInfo
' Set the connection credentials
myTableLogonInfo.ConnectionInfo = myConnectionInfo
' Apply this to the table found
myTable.ApplyLogOnInfo(myTableLogonInfo)
Next
End Sub



Protected Sub ASPxButton1_Click(sender As Object, e As EventArgs) Handles ASPxButton1.Click
CrystalReportViewer1.Visible = True
Dim cmp_name As String = ASPxComboBox1.Text
cmd.CommandText = "alter view synionic.cusanalysisrep as select * from cus_analysis1 where cmpname='" & cmp_name & "'"
cmd.Connection = con

reader = cmd.ExecuteReader()
reader.Close()

With CrystalReportViewer1


Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
' Set the server name
myConnectionInfo.ServerName = "servername"
' Set the database name
myConnectionInfo.DatabaseName = "mydatabsename"
' Use the logged in user credentials
myConnectionInfo.IntegratedSecurity = False
myConnectionInfo.UserID = "myid"
myConnectionInfo.Password = "mypwd"
Dim cr As New CrystalDecisions.CrystalReports.Engine.ReportDocument()

cr.Load(Server.MapPath("~\Reports\cus_analysisreport.rpt"))
SetDBLogonForReport(myConnectionInfo, cr)

' Set the database logon for the sub reports
.ReportSource = cr
.RefreshReport()
.Visible = True

End With

End Sub
End Class

my report is not viewing in website everytime logon prompt is asking even i have made logon code
i have made connection in oledb connection in crystal report

please help me out....friends
Posted
Comments
shakeer mp 7-Sep-14 6:48am    
its working properly in localhost

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900