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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:32:27+00:00 2026-05-23T03:32:27+00:00

I have a variable keypress that gets set when a phone call is made

  • 0

I have a variable “keypress” that gets set when a phone call is made into our system. The way it is written to our text file is as follows:

w.Write(attrColl["keypress"].Value);

What I need to do is pass these keypresses as they come in, to a sproc.

So, my first question is how do I pass it to the sproc, the code I have looks like this:

mySqlCommand.Parameters.Add("@Q1", SqlDbType.Int).Value = keypress;
mySqlCommand.Parameters.Add("@Q2", SqlDbType.Int).Value = keypress;

for example: if the first keypress is 500#, and the second keypress is 300#.
it should look like @Q1 = 500#, and @Q2 = 300#

Do I need to convert the keypress to a string first? If so, what is the best way of doing that, as I have about 10 questions that are given so I have 10 unique keypresses that come back.

And second, because there is a # sign at the end of every keypress, will the sproc input be a nvarchar as opposed to a int? Or what is the best way to handle a #.

Any thoughts, suggestion, or documentation is appreciated.

  • 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-23T03:32:27+00:00Added an answer on May 23, 2026 at 3:32 am

    I’ve assumed that your text file looks a little something like this, all on one line.

    100#400#900#

    I also assume that you’ve read this line back into a variable of somename.

    so

            var keypressline = "100#400#900#";
            var keyPresses = keypressline.Split('#');
            for (var i = 0; i < keyPresses.Length; i++)
            {               
                mySqlCommand.Parameters.AddWithValue("@Q" + i, keyPresses[i]);
            }
    

    I’ve purposely left @Q as a string. If you cast to an Integer you will lose the fact if 0 is pressed first.

    EDIT : Included load file code

    string fullPathAndFileName = @"C:\blah\blah.txt";
    string keypresses;
    using (StreamReader sr = new StreamReader(fullPathAndFileName)) 
    {
        while (sr.Peek() >= 0) 
        {
            keyPresses = sr.ReadLine();
        ...
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have variable that contains a number. While Lua allows variables to be set
I have a (C++) system that has many classes that have variable storage (memory)
I have a variable that is built in loop. Something like: $str = ;
I have a variable that contains a 4 byte, network-order IPv4 address (this was
If I have a variable in C# that needs to be checked to determine
I have a UITableView cell that is going to have a variable size depending
i have variable $result that contains this Country: USA City: NY Latitude: 32.2667 Longitude:
I often work with text files which have a variable amount of whitespaces as
I have variable XElement content = ... <item text=Name-1 id=1 segment=1 secret-id=Find-Me> <item text=Name-1-1
Is there a way in mathematica to have variable coefficients for NDSolve? I need

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.