0

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 by __avd: Added [code] tags. Encase your code in: [code] and [/code] tags.

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by __avd
Featured Replies
  • 1
    __avd 1,826   7 Years Ago

    [b]>When I click second time I got error Procedure or function "procedure name display" - has too many arguments specified.[/b] You are adding a parameter object each time. Use MyCommand.Parameters.Clear() method, [code] MyConnection.ConnectionString = connstring MyCommand.Connection = MyConnection MyCommand.CommandText = "sp_developer_display" MyCommand.CommandType = CommandType.StoredProcedure MyCommand.Parameters.Clear() Dim param As SqlParameter = … Read More

0

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.

1

>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.
Take the time to help us to help you. Please be thoughtful and detailed and be sure to adhere to our posting rules.