hi this is my coding if i run this coding. first time i able to get data then i click second time i got error Procedure or function "procedure name" display has too many arguments specified" why this error
plz explain for me

Dim mydst As New DataSet
        MyConnection.ConnectionString = connstring
        MyCommand.Connection = MyConnection
        MyCommand.CommandText = "sp_developer_display"
        MyCommand.CommandType = CommandType.StoredProcedure
        Dim param As SqlParameter = New SqlParameter("@developerid", txtdeveloperid.Text)
        Dim disp = New SqlDataAdapter(MyCommand)
        MyCommand.Parameters.Add(param)
        disp.Fill(mydst, "dev_display")
        txtdevelopercode.Text = mydst.Tables("dev_display").Rows(0).Item("developercode")
        txtdevelopername.Text = mydst.Tables("dev_display").Rows(0).Item("developername")
        txtqualification.Text = mydst.Tables("dev_display").Rows(0).Item("qualification")
        dtpdateofjoin.Value = mydst.Tables("dev_display").Rows(0).Item("dateofjoin")
        txtdesignation.Text = mydst.Tables("dev_display").Rows(0).Item("designation")
        txtexperience.Text = mydst.Tables("dev_display").Rows(0).Item("experience")
        txtknownsoftware.Text = mydst.Tables("dev_display").Rows(0).Item("knownsoft")

        mydst.Dispose()

Edited 6 Years Ago by __avd: Added [code] tags. Encase your code in: [code] and [/code] tags.

hi this is my coding if i run this coding. first time i able to get data then i click second time i got error Procedure or function "procedure name" display has too many arguments specified" why this error
plz explain for me

Dim mydst As New DataSet
MyConnection.ConnectionString = connstring
MyCommand.Connection = MyConnection
MyCommand.CommandText = "sp_developer_display"
MyCommand.CommandType = CommandType.StoredProcedure
Dim param As SqlParameter = New SqlParameter("@developerid", txtdeveloperid.Text)
Dim disp = New SqlDataAdapter(MyCommand)
MyCommand.Parameters.Add(param)
disp.Fill(mydst, "dev_display")
txtdevelopercode.Text = mydst.Tables("dev_display").Rows(0).Item("developercode")
txtdevelopername.Text = mydst.Tables("dev_display").Rows(0).Item("developername")
txtqualification.Text = mydst.Tables("dev_display").Rows(0).Item("qualification")
dtpdateofjoin.Value = mydst.Tables("dev_display").Rows(0).Item("dateofjoin")
txtdesignation.Text = mydst.Tables("dev_display").Rows(0).Item("designation")
txtexperience.Text = mydst.Tables("dev_display").Rows(0).Item("experience")
txtknownsoftware.Text = mydst.Tables("dev_display").Rows(0).Item("knownsoft")

mydst.Dispose()

I think you need to close the your connection when you finished with it same as for the dataAdapter and try to run the same code again.

>When I click second time I got error Procedure or function "procedure name display" - has too many arguments specified.

You are adding a parameter object each time.

Use MyCommand.Parameters.Clear() method,

MyConnection.ConnectionString = connstring
        MyCommand.Connection = MyConnection
        MyCommand.CommandText = "sp_developer_display"
        MyCommand.CommandType = CommandType.StoredProcedure

        MyCommand.Parameters.Clear()

        Dim param As SqlParameter = New SqlParameter("@developerid", txtdeveloperid.Text)
        Dim disp = New SqlDataAdapter(MyCommand)
        MyCommand.Parameters.Add(param)
        disp.Fill(mydst, "dev_display")
Comments
Great!
This article has been dead for over six months. Start a new discussion instead.