Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

All Events getting morethan one time

Hi Experts,

Dear Experts,

i've created one report using crystal report. in that i'm passing the dynamic parameter like this

If pVal.ItemUID = "Print" Then

oForm = SBO_Application.Forms.ActiveForm

oEdit = oForm.Items.Item("txtwkctr").Specific

patt = oEdit.Value

If patt "" Then

con1 = con1 & " and Code >='" & patt & "'"

End If

oedit1 = oForm.Items.Item("txtto").Specific

patt1 = oedit1.Value

If patt1 "" Then

con1 = con1 & " and Code <='" & patt1 & "'"

End If

wrkcenter = "SELECT * FROM dbo.@TI_WRKCTR where 1=1 " & con1

MasterWork.ShowDialog()

End If

after that i designed crystal report in a form and loading that windows form. then i have written follwing code in form load

Public Class MasterWork

Private Sub MasterWork_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'TODO: This line of code loads data into the 'DataSet1.__TI_WRKCTR' table. You can move, or remove it, as needed.

'Me._TI_WRKCTRTableAdapter.Fill(Me.DataSet1.__TI_WRKCTR)

Dim rpt As New WorkCenter()

Dim myConnection As SqlConnection

Dim MyCommand As New SqlCommand()

Dim myDA As New SqlDataAdapter()

Dim myDS As New DataSet1()

Dim tes As New Tespamfg 'The DataSet you created.

Try

myConnection = New SqlConnection("Server=" & servername & ";User Id=" & username & ";Password = ******;DataBase=" & databasename & ";")

MyCommand.Connection = myConnection

MyCommand.CommandText = wrkcenter

MyCommand.CommandType = CommandType.Text

myDA.SelectCommand = MyCommand

myDA.Fill(myDS, "@TI_WRKCTR")

rpt.SetDataSource(myDS)

CrystalReportViewer1.ReportSource = rpt

Catch Excep As Exception

MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try

End Sub

End Class

when i click on "Print" Button the form is loading with proper report. now i'm closing dialog(form).

next time next event geting twice. next time event getting thrice ..... when i close dialog its adding the event another time.

--

Mathi

Former Member
Not what you were looking for? View more on this topic or Ask a question