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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:36:08+00:00 2026-06-04T20:36:08+00:00

I am retrieving values from listbox and formatting them in string as if (lbRaisedByLogin.SelectedIndex

  • 0

I am retrieving values from listbox and formatting them in string as

if (lbRaisedByLogin.SelectedIndex != -1)
    {
        foreach (ListItem item in lbRaisedByLogin.Items)
        {
            if (item.Selected == true)
            {
                sb.AppendFormat("{0},", item.Value);
            }
        }

        searchCase.raisedByLogin = sb.ToString().TrimEnd(Convert.ToChar(","));
        sb.Length = 0;
    }

I am passing these strings to store procedure as parameter (Datatype– Varchar(Max))

in stored procedure I am comparing these values like

SELECT * FROM AUS_CID_Cases
WHERE
AddedBy IN ( @raisedByLogin )

Where @raisedByLogin is one of the parameter i passed. It has values like @raisedByLogin=”4,2,1″

AddedBy has datatype bigint.

When I run code I get error as “Error converting data type varchar to bigint.”.. I understand it is because AddedBy column has datatype bigint. I can not change that datatype.

However when i cast AddedBy like

SELECT * FROM AUS_CID_Cases
WHERE
CAST(AddedBy as VARCHAR) IN ( @raisedByLogin )

I dont get error, but nothing is selected i.e I dont get any result from select statement.

What can I do?

  • 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-06-04T20:36:10+00:00Added an answer on June 4, 2026 at 8:36 pm

    First create this view

    CREATE FUNCTION [dbo].[Split](@String varchar(8000), @Delimiter char(1))       
    returns @temptable TABLE (items varchar(8000))       
    as       
    begin       
        declare @idx int       
        declare @slice varchar(8000)       
    
        select @idx = 1       
            if len(@String)<1 or @String is null  return       
    
        while @idx!= 0       
        begin       
            set @idx = charindex(@Delimiter,@String)       
            if @idx!=0       
                set @slice = left(@String,@idx - 1)       
            else       
                set @slice = @String       
    
            if(len(@slice)>0)  
                insert into @temptable(Items) values(@slice)       
    
            set @String = right(@String,len(@String) - @idx)       
            if len(@String) = 0 break       
        end   
    return  
    

    then change the query to this and try,

    SELECT * FROM AUS_CID_Cases
    WHERE
    CAST(AddedBy as VARCHAR) IN ( select * from split(@raisedByLogin,',') )
    

    found above Function here, and managed to solve this issue sometime back…

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

Sidebar

Related Questions

Have this dictionay retrieving values from DataTable: Dictionary<string,string> meta= ds.Tables[1].Select(key<>'format').AsEnumerable().ToDictionary(k=>k.Field<string>(0),v=>v.Field<string>(1)); How would I apply
I am retrieving values from a database and displaying it a table using php.
I'm trying to autocomplete a textbox. I'm retrieving values from Access Database. Just one
I am retrieving values from the url with the GET method and then using
I'm retrieving several values from a sequence, but need to do so twice for
I aldready succed retrieving http values from the web. However, I still rarely have
I am retrieving a list of values from a sharepoint list, which works well
I am retrieving some values from DB in form of ArrayList of 240 size
I have a problem retrieving default values from the settings bundle when first launching
I am retrieving two date time values from the database. Once the value is

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.