.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

geting string from integer using enums

Posted By:      Posted Date: October 06, 2010    Points: 0   Category :ASP.Net

we know 

The .NET Framework contains an Enum called DayOfWeek.

so now if i have an integer 7
how can i ge the string "Saturday" using  the enum

View Complete Post

More Related Resource Links

HowTo Marshal C++ enums and copy buffer of unsigned 16bit integer


Hi together,

I'm trying to wrap an API of a digital camera SDK (unmanaged C++). Some of the functions a working, but some of them ... :(

1. HowTo marshal  C++  enums?

This is a part of the api.h file:



	DCAM_DATATYPE_UINT8	=	0x00000001,	/* bit 0 */
	DCAM_DATATYPE_UINT16	=	0x00000002,	/* bit 1 */
	DCAM_DATATYPE_UINT32	=	0x00000008,	/* bit 3 */
	DCAM_DATATYPE_MOSAIC8	=	0x00010000,	/* bit 16, 8bit mosaic */
	DCAM_DATATYPE_MOSAIC16	=	0x00020000,	/* bit 17, 16bit mosaic */
	DCAM_DATATYPE_RGB24	=	0x00040000,	/* bit 18, 8bit*3, [ r0, g0, b0], [r1, g1, b1] */
	DCAM_DATATYPE_RGB48	=	0x00100000,	/* bit 20, 16bit*3, [ r0, g0, b0], [r1, g1, b1] */


BOOL DCAMAPI dcam_getdatatype			( HDCAM h, DCAM_DATATYPE* pType );
BOOL DCAMAPI dcam_setdatatype			( HDCAM h, DCAM_DATATYPE type );<br/>


And this is what I wrote in C#:

SSIS Error in Script task: "Conversion from string "C002" to type 'Integer' is not valid"


Hi All,

I have a script component in my Dataflow that generates Error Description string.

But I am not trying to convert anything in my Script as you can see below.

Here is the Code inside the SCR_component.


Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper

Public Class ScriptMain
    Inherits UserComponent
    Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
     'Use the incoming error number as a parameter to GetErrorDescription
    Row.ErrorDescription = ComponentMetaData.GetErrorDescription(Row.ErrorCode)
   End Sub
End Class


When I run the package , it fails at this script task with the following error:

Description: System.InvalidCastException: Conversion from string "C002" to type 'Integer' is not valid.


The value "C002" is actually a column in the metadata and its type is "DT_STR". I am not trying to convert it in my Script as you can see

Public Function Testing (ByVal FirstString as String, ByVal FirstInteger as Integer), how to pass a


I have the following function, sometimes I want to pass a DBNULL.Value to the function so I update the database with a null value, but it won't let me as the DBNULL.Value is not a string or an integer, how can I get this to work?

Public Function Testing (ByVal FirstString as String, ByVal FirstInteger as Integer), how to pass a DBNULL.Value?

' update database

Return value

End Function

ASCII string to integer grouping equivalent?


Hi I have been trying unsuccssfully to convert a column of data (mycolumn) from a table (mytable)  that has ascii character strings comprised of characters numbered from 0-255. I need to be able to group the numeric values for each ascii string from each record, into what I call an integer group and write that value back to a different column for each respective record in the table. But, I can't figure out how to modify the following Microsoft code to perform this:



-- Create the variables for the current character string position 

-- and for the character string.

DECLARE @position int, @string char(15)

-- Initialize the variables.

SET @position = 1 

SET @string = 'Du monde entier' --here I don't know how to pass a selected column to the @string

WHILE @position <= DATALENGTH(@string) --here I need to know how to loop through each records ascii string and group the values


 SELECT ASCII(SUBSTRING(@string, @position, 1)),

  CHAR(ASCII(SUBSTRING(@string, @position, 1)))

 SET @position = @position + 1


SET NOCOUNT OFF -- then down here somewhere I need to write each converted string to integers back to the myintegerGroup column


The output from above is below, But I need grouped examp: Du monde entier => 681173210911111010010132101110116105101114


How can i convert Integer to String in SSIS Derived column.


i have gender column with 0,1 values

i`ve to convert it into 0=male and 1=female,i tried this


BUT it is giving error

TITLE: Microsoft Visual Studio

Error at Data Flow Task [Derived Column [46]]: The data types "DT_WSTR" and "DT_I4" are incompatible for binary operator "==". The operand types could not be implicitly cast into compatible types for the operation. To perform this operation, one or both operands need to be explicitly cast with a cast operator.

Error at Data Flow Task [Derived Column [46]]: Attempt to set the result type of binary operation "Gender == 0" failed with error code 0xC0047080.

Error at Data Flow Task [Derived Column [46]]: Computing the expression "[Gender] ==0?"Male":[Gender]==1?"Female":"NA"" failed with error code 0xC0047084. The expression may have errors, such as divide by zero, that cannot be detected at parse time, or there may be an out-of-memory error.

Error at Data Flow Task [Derived Column [46]]: The expression "[Gender] ==0?"Male":[Gender]==1?"Female":"NA"" on "input column "Gender" (114)" is not valid.

Error at Data Flow Task [Deri

Conversion from string to type 'Integer' is not valid


Hi Guys,

I have the following IF Statement checking if the function GetNexstAddress (which gets the ClientID from  GetClientFleetInfo(i).CLIENTID) . SECONDARYCITY

is there.



If GetNextAddress(GetClientFleetInfo(i).CLIENTID).SECONDARYCITY(0) = Nothing Then
NextAddress = " No next Destination"
NextAddress = GetNextAddress(GetxxxxFleetInfo(i).TNO).CITY(0)
End If


somehow I get the error.

+exception{"Conversion from string "111 AA BB" to type 'Integer' is not valid."}System.Exception


Do you have any idea how to fix this?

PS: I have searched through the forum but not found an answer yet.


Workflow create item returning integer... Should be a string.




Im passsing information to a new item in a different list using the create item workflow.


It seems to work from apart from one, critical field. The create item should (i hope) pass a valie from a field  'FIELD' in List A to 'FIELD' in ListB.   in list a the field is a lookup from a reference list.

The create new List item workflow ____ it but only returns the type as an integer (an its the oonly option) .

Can you explain where im going wrong?


Setting the Pipename - Converting integer to string to LPCSTR


I am trying to create a pipename - \\.\pipe\CC-("PID in hex")... I get a PID once I create the process and it is stored in po.dwProcessID.


How do I create the LPCSTR such that it has \\.\pipe\CC-12A2 if 12A2 is the PID in hex.





How to Encrypt Query String Parameters in ASP.NET

Encrypt Query String Parameters in ASP.NET.u can send secure data one page another page u can also use query string to encrypt

Connestion string create any database server

This links important to how to create connection string to any data base sever.

SQL Connection String

We can learn or know how can we connect the database from our .net. This will help for freshers or .NET beginners!

Built-in Functions - String Functions

String functions let you extract various portions of character strings, change the case of strings, concatenate and reverse strings and perform many other types of manipulations. All built-in string functions are deterministic with the exception of CHARINDEX and PATINDEX

abstract away the source of the connection string using a class with a static property.

ASP.NET provides a configuration system we can use to keep our applications flexible at runtime. In this article we will examine some tips and best practices for using the configuration system for the best results.

The element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

Let's abstract away the source of the connection string using a class with a static property.

highlight string


i am looking for a function that takes two string parameters 

str1 = "hello how are you today mr john"

str2 = "how today"

and in return it shoud highlight the words "how" and "today".

Any ides? I prefer if its possible using reg expression...Thanks

Could some one tell me whats the Problem with this String Manipulation ??? C#.net



I store some values from code behind to a label which is Hidden !

<asp:Label ID="lbl_Hidden" runat="server" Visible = "false"></asp:Label>

and at the page load event i retrieve the value of the label & assign it to a string !

stringvalue = lbl_Hidden.Text;

Now i dont know why this manipulation does'nt work !

I've a character 'A' in the string and i'm unable to replace it with a space !

stringvalue.Replace(A, " ");

Wot do u think abt it ????

extract picture data from a string


dears,advance thanks.can anybdy help to solve my problem which is describing below.

Example- %%D1,100,0,0004[data...][0d0a]

Head - %%D1
Amount of data package -100
The data package No. - 0
Data Length -1024 (0004 (low bit in front, high bit in back) 0004= 0x0400=1024;)

data- Original Picture data -1024(maximum)
Tail -0x0d0a
Data in hex

from the above example i want to extract picture data and need to store in to the sql table.sql table columname is image and datatype is also image.after that i wanted to display this image column to an aspx page.

expecting help asap.

Integer Validation



I need to make validation for Textbox to allow enter integer stated by 9 or 6 or 5 , and also maximum 8 digits , how to do that ?





ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend