Advertisement

01.12.2007 at 01:01PM PST, ID: 22121027
[x]
Attachment Details

I keep getting this error: The SqlParameterCollection only accepts non-null SqlParameter type objects, not Boolean objects.

Asked by GabicusC in .NET Framework 2.0, Microsoft Visual Basic.Net

Tags: sqlparametercollection, accepts, only, sqlparameter, type

I have the following code that when i run it I keep getting this error:

The SqlParameterCollection only accepts non-null SqlParameter type objects, not Boolean objects.

on intidVenue

But everyplace I use or declare this intidVenue I declare it as a Integer.  Why do I keep getting InvalidCastCexeption Error and how do I fix it?

Thanks


    Dim intidVenue As Integer = clCentral.intidVenue
    Dim intidUser As Integer = clCentral.intidUser

    Public Function intUpdateVenueMember(ByVal idVenue As Integer, ByVal idUser As Integer, ByVal idUserLast As Integer) As Integer
        Try
            Dim cmdUpdateVenueMember As New SqlCommand("updateVenueMember", objConn)
            cmdUpdateVenueMember.CommandType = CommandType.StoredProcedure
            cmdUpdateVenueMember.Parameters.Add(New SqlParameter("@idVenue", SqlDbType.Int).Value = idVenue)
            cmdUpdateVenueMember.Parameters.Add(New SqlParameter("@idUser", SqlDbType.Int).Value = idUser)
            cmdUpdateVenueMember.Parameters.Add(New SqlParameter("@idUserLast", SqlDbType.Int).Value = idUserLast)
            objConn.Open()
            cmdUpdateVenueMember.ExecuteNonQuery()
            intUpdateVenueMember = 0
            objConn.Close()
        Catch ex As SqlClient.SqlException
            If objConn.State = ConnectionState.Open Then
                objConn.Close()
                intUpdateVenueMember = 0
            End If
            MessageBox.Show(ex.Message)
        End Try
    End Function

---- Stored procedure

create procedure updateVenueMember(
                              @idVenue int,
                              @idUser int,
                              @idUserLast int
                        )
as
set nocount on

      update tblVenue
      set idUser = @idUser,
            idUserLast = @idUserLast
      where      idVenue = @idVenue

GO
Start Free Trial
[+][-]01.12.2007 at 01:45PM PST, ID: 18305255

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.12.2007 at 01:49PM PST, ID: 18305281

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .NET Framework 2.0, Microsoft Visual Basic.Net
Tags: sqlparametercollection, accepts, only, sqlparameter, type
Sign Up Now!
Solution Provided By: GabicusC
Participating Experts: 1
Solution Grade: B
 
 
[+][-]01.12.2007 at 02:00PM PST, ID: 18305351

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.15.2007 at 08:18AM PST, ID: 18317068

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32