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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:48:38+00:00 2026-05-20T05:48:38+00:00

I seem to be gnawing at this issue, and although I can see how

  • 0

I seem to be gnawing at this issue, and although I can see how it should work, I can’t seem to see the wood for the trees..

Basically I have a situation where I have a SQL 2008 stored procedure.. very basic.. simple varchar’s and int’s etc.
Because I am getting the value/pair data from javascript, of course I don’t implicitly know the DbType to set.. I know this sounds a bit off perhaps, and I could technically add some sort of tag to the fieldname to indicate the actual type.

So right now I am trying to do the following:

(I am using the Enterprise Library Data Access Block, but db is the database object/connection object) – also the val/pairs are from a hashtable..

db.DiscoverParameters(cmd);
IDictionaryEnumerator de;
de = PDMdata.GetEnumerator();
while (de.MoveNext())
{
    DbType ptype = cmd.Parameters[de.Key.ToString()].DbType;
    db.AddInParameter(cmd, de.Key.ToString(), ptype, (ptype)de.Value.ToString());
}

For reference, the db.AddInParameter takes the Command object, param name, param type and param value..

As you can see I am trying to cast the value as correct SQL DbType.. but of course it is trying to use the normal C# Type..

Any ideas of converting the value to the dynamic SQL DbType??

Thanks in advance for your help..

  • 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-20T05:48:39+00:00Added an answer on May 20, 2026 at 5:48 am

    Ok, silly me.. if I am already checking the format/data quality in the frontend/middleware, then I can (because I am using the Enterprise Library 5.0) .SetParameterValue(cmd, paramname, paramvalue) and the parameter discovery will take care of the rest…

    So basically instead of using the Explicit .AddInParameter (which needs the DbType), the above solution works for me.. might for you too in this scenario.

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

Sidebar

Related Questions

I seem to have a problem and can't get it work. I'm working on
I seem to have been running this issue a lot recently. How is this
I seem to have run into a bit of trouble this morning with removeClass
I seem to have some files in my Xcode project that I can't erase.
Seem more..issue (Operation slows down after clicking see more 5-10 times) Ive modified See
I seem to get something fundamentally wrong. I have this HTML <div id=thumbnails> <a
Cannot seem to get a mod_rewrite to work. We have a domain name that
I seem to have a 32bit vs. 64bit problem here. It should be simple
I seem to be a little lost on what to so about this, im
I seem to have a problem passing some strings on from one form to

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.