This is the error when i try to execute my code "Procedure or function 'Get Customer data' expects parameter '@Name', which was not supplied."

objCommand.CommandType = CommandType.StoredProcedure
        objCommand.CommandText = "GetCustomerData"
        Dim ObjParam1 As New SqlParameter("@Name", SqlDbType.VarChar, 2000)

        ObjParam1.Value = ID.ToString()

        Dim da As New SqlDataAdapter(objCommand)
        Dim dt As New DataTable
        da.Fill(dt)// error shows here
        DetailsView2.DataSource() = dt
        DetailsView2.DataBind()

        objConnection.Close()

In debugging, i c the value in ObjParam1.value that I'm passing.
Any suggestions please.

Thanks

You are creating the SqlParameter Object but you're not adding it to the Command Object.

Sorry I don't have the time to look it up... but there should be some sort of method of the objCommand to add parameters to it.

something like
objCommand.Parameter.Add("@Name", SqlDbType.Int, 4)
objCommand.Parameters["@Name"].Value = ID.ToString

hi uzn. Try inserting this line:

objCommand.Parameters.Add(objParam1)
Be a part of the DaniWeb community

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