parameter passing

ntombisizulu

Member
Joined
Jun 1, 2005
Messages
12
Programming Experience
1-3
:eek: please help i don't understand this error. i am passing parameters to a stored procedure to search for the criteria as defined by the parameters and this is the error that i get:

Parameter 2: 'Parameter1' of type: String, the property Size has an invalid size: 0 http://www.vbdotnetforums.com/
 
if you could post the code that passes the parameter(s) as well as any other code that relates to it that would help us identify where&why you're getting the error
 
this is the code that i used....

Private
Sub butSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butSearch.Click
SearchCriteria()

End Sub

Private Sub SearchCriteria()

'gets the required information based on the search criteria.

Dim SqlReader As SqlDataReader

Dim retry As Integer

Dim isConnected As Boolean

Dim parmResult As New SqlParameter

Dim blnIsError As Boolean = False

isConnected = True

If OpenConnection() = False Then

For retry = 1 To 3 Step 1

If OpenConnection() = True Then

isConnected = True

Exit For

Else

isConnected = False

End If

Next

End If

IRSComm.CommandText = "proc_search_criteria"

IRSComm.CommandType = CommandType.StoredProcedure

IRSComm.CommandTimeout = 600

IRSComm.Parameters.Clear()

If CBCategory.Checked = True Then

IRSComm.Parameters.Add("@Category", System.Data.SqlDbType.VarChar)

IRSComm.Parameters("@Category").Value = DListCategory.SelectedValue

End If

If CBImpact.Checked = True Then

IRSComm.Parameters.Add("@Impact", System.Data.SqlDbType.VarChar)

IRSComm.Parameters("@Impact").Value = DListImpact.SelectedValue

End If

If CBDtRange.Checked = True Then

IRSComm.Parameters.Add("@from_dt", System.Data.SqlDbType.DateTime)

IRSComm.Parameters.Add("@to_dt", System.Data.SqlDbType.DateTime)

If txtDtFrom.Text <> "" Then

IRSComm.Parameters("@from_dt").Value = txtDtFrom.Text

Else

IRSComm.Parameters("@from_dt").Value = System.DateTime.Now.ToString

End If

If txtDtTo.Text <> "" Then

IRSComm.Parameters("@to_dt").Value = txtDtTo.Text

Else

IRSComm.Parameters("@to_dt").Value = System.DBNull.Value

End If

End If

With parmResult

.DbType = DbType.String

.Value = System.DBNull.Value

.Direction = ParameterDirection.Output

End With

IRSComm.Parameters.Add(parmResult)

Try

IRSComm.ExecuteNonQuery()

blnIsError =
False

Catch ex_sql As SqlException

blnIsError =
True

msglbl.Text = ex_sql.Message

Catch ex As Exception

blnIsError =
True

msglbl.Text = ex.Message

End Try

CloseConnection()

'if the search is executed then the results that are obtained are displayed on the result.aspx page

If blnIsError = False Then

Response.Redirect("results.aspx?result=" & parmResult.Value)

End If

End Sub

 
Back
Top