Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6971897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:53:54+00:00 2026-05-27T16:53:54+00:00

for a few days I’ve been trying and trying to get the stored procedure

  • 0

for a few days I’ve been trying and trying to get the stored procedure to work in vb.net, but I can’t seem to make it work.

I’d really appreciate it if someone could help me out here. I’ve been trying really hard to solve this problem, but I just can’t find a solution.

Private Sub getID()
    Dim ds As New DataSet
    Dim con_str = ""
    Dim con As MySql.Data.MySqlClient.MySqlConnection = New MySql.Data.MySqlClient.MySqlConnection(con_str)
    con.Open()
    Dim cmd As MySql.Data.MySqlClient.MySqlCommand = New MySql.Data.MySqlClient.MySqlCommand
    cmd.CommandType = CommandType.StoredProcedure
    cmd.CommandText = "getID()"
    cmd.CommandType = CommandType.StoredProcedure

    cmd.Parameters.AddWithValue("@id", "113")
    Dim da As MySql.Data.MySqlClient.MySqlDataAdapter = New MySql.Data.MySqlClient.MySqlDataAdapter(cmd)
    Dim dt As New DataTable
    da.SelectCommand.Connection = con
    da.Fill(dt)
End Sub

When I try to run this I get the exception “Incorrect number of arguments for PROCEDURE otrs.getID; expected 1, got 0” on the line da.Fill(dt). I don’t really know why this happens. There is no argument declared in my stored procedure.

My stored procedure should be fine. Calling it out of the dbms worked out fine, but here is the code anyways:

delimiter $$
CREATE DEFINER=`otrs`@`%` PROCEDURE `getCIs`()
BEGIN
SELECT  
    l.source_key AS base_id,  
    c1.configitem_number AS base_number,
    v.name as base_name,
    l.target_key AS link_id,  
    c2.configitem_number AS link_number,
    v1.name as link_name,
    t.name as link_type
FROM  
    otrs.link_relation AS l
        INNER JOIN  
    otrs.configitem AS c1 
        ON l.source_key = c1.id     
        INNER JOIN  
    otrs.configitem AS c2 
        ON l.target_key = c2.id    
        INNER JOIN
    otrs.link_type AS t
        INNER JOIN
    otrs.configitem_version AS v
        ON l.source_key = v.configitem_id
        INNER JOIN
    otrs.configitem_version AS v1
        ON l.target_key = v1.configitem_id;
END$$

And yes, I did use the search-function and I googled quite a lot, but I’m still thankful for any kind of information regarding my problem.

So I found out was wrong. Apparently you dont need the () after the procedure-name. Im not 100% sure though, because now nothing happens at all:

Private Sub getID()
    Dim ds As New DataSet
    Dim con_str = ""
    Dim con As MySql.Data.MySqlClient.MySqlConnection = New MySql.Data.MySqlClient.MySqlConnection(con_str)
    con.Open()
    Dim cmd As MySql.Data.MySqlClient.MySqlCommand = New MySql.Data.MySqlClient.MySqlCommand
    cmd.CommandType = CommandType.StoredProcedure
    Try
        cmd.CommandText = "getID"
    Catch ex As Exception
        MsgBox(ex.Message())
    End Try

    cmd.Parameters.AddWithValue("@id", 113)
    cmd.Connection = con
    Dim da As MySql.Data.MySqlClient.MySqlDataAdapter = New MySql.Data.MySqlClient.MySqlDataAdapter(cmd)
    Dim dt As New DataTable
    Try
        da.Fill(dt)
    Catch ex As Exception
        MsgBox(ex.Message())
    End Try
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:53:55+00:00Added an answer on May 27, 2026 at 4:53 pm

    This line is wrong it creates a new command with the command text of “call getID()” and adds it to the adapter with no parameters

      Dim da As MySql.Data.MySqlClient.MySqlDataAdapter = _
       New MySql.Data.MySqlClient.MySqlDataAdapter("call getID()", con_str)
    

    you want

      cmd.CommandText = "getID"  
      Dim da As MySql.Data.MySqlClient.MySqlDataAdapter = _
       New MySql.Data.MySqlClient.MySqlDataAdapter(cmd, con_str)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Last few days i was trying to get jqgrid with autocompletion fields to work,
For few days I have been trying to figure out how to use make
For a few days now I have been trying to get an ASMX webservice
few days ago i read tutorial about GenericRepository and Unit Of Work patterns http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application
Last few days I'm trying to start with farseer library, however i just can't
before few days i have been comfortably sending emails using PHP mail function. but
Over the past few days I have been trying to create/run a project in
few days ago i asked about how to get all running processes in the
A few days ago, I had an issue with ASP.Net threading. I wanted to
A few days ago my .NET 3.5 applications began to fail while start issuing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.