hi
am doing program in vb.net 2010 with sql serevr 2008 and i would like to pass a parameter to my crystal report to print a two related table and make an invoic print
here is my code
Private Sub CmdSearchNo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSearchNo.Click
Try
Dim em1 As String = InputBox("Enter inv_no?")
Dim conn As SqlConnection
conn = New SqlClient.SqlConnection
conn.ConnectionString = "Data Source=dell-dsl\sqlexpress;Initial Catalog=STOCK;Integrated Security=True"
conn.Open()
Dim cmm As SqlCommand
cmm = New SqlClient.SqlCommand
cmm.Connection = conn
cmm.CommandText = "select * from INVHEADOUT where inv_no= '" & Trim(em1) & "' "
cmm.CommandType = CommandType.Text
Dim read As SqlClient.SqlDataReader
read = cmm.ExecuteReader
If Not read.Read Then
MsgBox("inv_no not found")
read.Close()
conn.Close()
Else
Dim pram As New ParameterFields
Dim para As SqlParameter
para = New SqlParameter("@pinv_no", SqlDbType.SmallInt)
para.Value = em1
Dim par As New ParameterField
par.ParameterFieldName.Equals("@pinv_no")
par.CurrentValues.Add(para)
pram.Add(par)
CrystalReportViewer1.ParameterFieldInfo = pram
CrystalReportViewer1.Visible = True
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
its under my print button and the error message is ( invalide object type ) in the line
par.CurrentValues.Add(para)
any suggestion or help?
thx