Below is my code for adding parameters in my vb .net code for prepared statements of npgsql.

Dim xConn As NpgsqlConnection = ConnectDB()
Dim xCmd As NpgsqlCommand = xConn.CreateCommand()

xCmd.CommandText = "UPDATE " & xTable & " SET previous_tot_adj = @prev_adj ,tot_adj = @tot_adj WHERE version = " & _version & " AND monthly_mq_id = @Index"

For Each Index In _Results.Keys

    If Not IsNothing(_Results.Item(Index)) Then

        xCmd.Parameters.AddWithValue("prev_adj", NpgsqlTypes.NpgsqlDbType.Double, _Results.Item(Index))
        xCmd.Parameters.AddWithValue("tot_adj", NpgsqlTypes.NpgsqlDbType.Double, _Results.Item(Index))
        xCmd.Parameters.AddWithValue("Index", NpgsqlTypes.NpgsqlDbType.Bigint, Index)

    End If



After executing this code i get this kind of error .

A first chance exception of type 'Npgsql.NpgsqlException' occurred in Npgsql.dll
ERROR: 08P01: bind message has 34193 parameter formats but 1 parameters

Can anyone enlighten me for what's wrong on what I'm doing?


OMG! no one wants to bother! thanks anyways. :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.