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 6880133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:56:07+00:00 2026-05-27T04:56:07+00:00

i am currently writting a method that reads date from a firebird database. Here

  • 0

i am currently writting a method that reads date from a firebird database.
Here is the Header :

 public static void ReadInfo(int first, int skip,string orderBy)

That is my SQL Query :

const string SQL = "SELECT FIRST @first SKIP @skip A.ID,B.SHORTNAME, A.DATETIME, A.COMPUTERNAME,A.OSLOGIN, A.DBLOGIN, A.INFOTYPE, A.INFO FROM EVENTSGENERAL A JOIN EVENTSGENERATORS B ON B.GENERATOR_ = A.GENERATOR_ ORDER BY @orderBy";

And here is where i prepare the parameters for the query:

cmd.Parameters.Add("@first", FbDbType.Integer).Value = first;
cmd.Parameters.Add("@skip", FbDbType.Integer).Value = skip;
cmd.Parameters.Add ("@orderBy", FbDbType.VarChar, 50).Value = orderBy;

The problem is: The first two parameters work (first and skip are prepared correctly),i´ve tested it. But,the orderBy parameter raises an exeption once i try to run it :

{"Dynamic SQL Error\r\nSQL error code = -804\r\nData type unknown"}

I´ve tried to change toe FbDbType to “Text”,but still not working.
Sorry about any bad english.
Thanks in advance for any help given.

  • 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-27T04:56:08+00:00Added an answer on May 27, 2026 at 4:56 am

    For order by clause needs field specified you cant pass field name. What may work is if you make @orderBy parameter datatype integer and pass index of field. for example

    select id, name from city order by 1 //this will order by id field
    

    or if you programmatically edit sql statement like this:

    string SQL = "SELECT FIRST @first SKIP @skip A.ID,B.SHORTNAME, A.DATETIME,
     A.COMPUTERNAME,A.OSLOGIN, A.DBLOGIN, A.INFOTYPE, A.INFO FROM EVENTSGENERAL A JOIN
     EVENTSGENERATORS B ON B.GENERATOR_ = A.GENERATOR_ ORDER BY {0}";
    SQL = string.Format(SQL, orderBy);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently writing some methods that do some basic operations on form controls eg
I am currently writting a programe about Conway's Game of life and I am
I am currently writing a simple, timer-based mini app in C# that performs an
I'm currently writing an ASP.Net app from the UI down. I'm implementing an MVP
I'm writing some code that calls a web service, reads back the response and
I'm currently writing a program that needs to compare each file in an ArrayList
I'm writing an application that creates catalogs of files. Currently the catalog information is
I am writing a project that reads a file and sorts Words. This code
I have an application that I am writting that communicates with a third-party program
I have a method that, given an angle for North and an angle for

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.