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()

Recommended Answers

All 2 Replies

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")
commented: Great! +1
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.