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

  • Home
  • SEARCH
  • 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 5951403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:31:55+00:00 2026-05-22T17:31:55+00:00

I a Parameter ordial = 1 error on this code. Can anyone explain it

  • 0

I a Parameter ordial = 1 error on this code.
Can anyone explain it in this context? dbCon is correct as I can insert data to the database just trying out how to get it back no.

              if (dbCon.State == ConnectionState.Closed)
            {
                dbCon.Open(); ;
            }

            SqlCeParameter vetidfromdropbox = new SqlCeParameter("@vetidfromdropbox", SqlDbType.Int);
            vetidfromdropbox.Value = 2;

            SqlCeCommand mySQLCommand = new SqlCeCommand("SELECT * FROM vets WHERE vetID = @vetidfromdropbox", dbCon);

            SqlCeDataReader rdata = mySQLCommand.ExecuteReader();


            if(rdata.Read()){

                    editNameTextbox.Text = (String)rdata["vetName"];
                    editSurnameTextbox.Text = (String)rdata["vetSurname"];
                    editCompanyNameTextbox.Text = (String)rdata["vetCompanyName"];
                    editPractiseAddTextBox.Text = (String)rdata["vetPractiseAddress"];
                    editMobileTextbox.Text = (String)rdata["vetMobile"];
                    editOtherTextbox.Text = (String)rdata["vetOther"];
                    editNotesTextbox.Text = (String)rdata["vetNotes"];

                }else{
                        MessageBox.Show(" There has been an error with Read() ");                               
                }



            if (dbCon.State == ConnectionState.Open)
            {
                dbCon.Close();
            }
  • 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-22T17:31:56+00:00Added an answer on May 22, 2026 at 5:31 pm

    You didn’t add parameter to your SQL command:

    var vetidfromdropbox = new SqlCeParameter("@vetidfromdropbox", SqlDbType.Int);
    vetidfromdropbox.Value = 2;
    
    var mySQLCommand = new SqlCeCommand(
        "SELECT * FROM vets WHERE vetID = @vetidfromdropbox", dbCon);
    mySQLCommand.Parameters.Add(vetidfromdropbox);
    

    You can use AddWithValue to simplify the syntax:

    var mySQLCommand = new SqlCommand(
        "SELECT * FROM vets WHERE vetID = @vetidfromdropbox", dbCon);
    mySQLCommand.Parameters.AddWithValue("vetidfromdropbox", 2);
    

    Side note: use using on your sql connection and command to guarantee disposal and to simplify code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got this parameter: $objDbCmd.Parameters.Add(@telephone, [System.Data.SqlDbType]::VarChar, 18) | Out-Null; $objDbCmd.Parameters[@telephone].Value = $objUser.Telephone; Where the
I constantly get this error using mako: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0'
a template parameter can be used in another template parameter that follows it this
A parameter defaulted to an empty hash attrs={} returns an error: can't convert Array
This code not work correctly: getHibernateTemplate() .find(from elephant.model.Setup s where s.settingName = ?,setupName); Error:
Has the $format parameter been removed with the VS2008 SP1 release of ADO.NET Data
I have a parameter like this: rightOperand:(const NSDecimal*)rightOperand how could I provide a value
When defining parameter type that is e.g. in System.Data you have no intellisense and
I don’t fully understand the second parameter of string.Equals, and this is because I
Can you pass a parameter to a view's map function from the query part

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.