Try Dim myReport As New ReportDocument Dim paramFields As New ParameterFields Dim paramField1 As New ParameterField Dim discreteVal1 As New ParameterDiscreteValue Dim logonInfo As New TableLogOnInfo Dim table As Table myReport.Load(Server.MapPath("CrystalReport.rpt")) For Each table In myReport.Database.Tables logonInfo = table.LogOnInfo logonInfo.ConnectionInfo.ServerName = "ABC-PC" logonInfo.ConnectionInfo.DatabaseName = "AgMarkDb" logonInfo.ConnectionInfo.UserID = "sa" logonInfo.ConnectionInfo.Password = "sa123" table.ApplyLogOnInfo(logonInfo) Next table Dim date1 As Date Dim dt As String Dim Culture As IFormatProvider Culture = New CultureInfo("en-GB", True) date1 = DateTime.Parse(TextBox1.Text.ToString, Culture, DateTimeStyles.NoCurrentDateDefault) paramField1.ParameterFieldName = "currentdate" discreteVal1.Value = date1 paramField1.CurrentValues.Add(discreteVal1) paramFields.Add(paramField1) CrystalReportViewer1.ParameterFieldInfo = paramFields CrystalReportViewer1.ReportSource = myReport CrystalReportViewer1.Visible = True Catch ex As Exception Response.Write("DATABASE CONNECTION FAILED PLEASE TRY AFTER SOME TIMES") Exit Sub End Try
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)