converting string to small int problem

Hi all,
I have radiobutton (for male and female check) The problem I am getting error if I try to convert the string(Sex) to the database(smallint)

Here is my code:

    public class MakeAppointment
     private MakeApptEntities newAppointment = new MakeApptEntities();

        public void add( string FirstName, string LastName,  string Sex) {

       tbl_MakeAppointment_MA nAppt = new tbl_MakeAppointment_MA();
       tbl_PatientDetails_PD pDetails = new tbl_PatientDetails_PD(); 
                            pDetails.PD_FirstName = FirstName;
                            pDetails.PD_LastName = LastName;
                            pDetails.PD_Sex = Convert.ToInt16(Sex);

can anybody help please?
Ashraf (1)
12/16/2014 7:49:00 AM 29307 articles. 3 followers. Post Follow

0 Replies

Similar Articles

[PageSpeed] 11
Get it on Google Play
Get it on Apple App Store


Similar Artilces:

Problems converting string to int.
I'm taking a value from the database and converting it to a number in the format 000,000.00 and then populating that data into a text box. The user can edit this value and then save the data, I try to convert this number to an int (Convert.ToInt32) value to pass to the sproc but I get the following error: Input string was not in correct format. I've narrowed the problem area to be the comma, does anyone know a way around this? Thanks! The only way I've found around this is to write a small loop to remove commas from the value. if mid(string,i,1) = "," then... Hope th...

How to convert Int to string and string to Int in Java Script
 How to convert Int to string and string to Int in Java Script 1:var strVar='23' ;var intVar=parseInt(strVar); any other method for this2:var intVar= 23;var strVar=intVar+''; any other method for this conversion please help me? thanks   Those methods work for what you need them to do.  Are you looking for alternatives?  I never lose, some people are just better than me at winning. 1: var strVar='23' ; var intVar=parseInt(strVar); any other method for this var intVar=strVar-0; var intVar=strVar*1; var intVar=strVar/1; var in...

converting type int to string problem
Hi there,I have am adding a number of days to some integer values I am getting from a SQL table(Sunday =1).  I am then using DateTime.Now.AddDays in an if statement.  The adding days is working OK but I want to concert the result to a string so i get eg. Monday 23rd May. the data is being called in a DataGrid. here is the code in my method: private DataSet TransformDataSet(DataSet Myds, List<string> MyColumnNames)        {            //change column names    ...

Convert INT value to STRING so I can add it to another STRING
I'm trying to figure out how to convert an INT so that I can add it to another string in a statement likeSELECT '<a href="' + [IntValue] + '">' + [LinkName]Where [IntValue] is an INT field containing a folder number.  I tried: TO_CHAR([IntValue, '999')but it didn't work. And I tried to find a TO_STRING function, but had no luck.Any advice to someone who is savy, but new to SQL Queries? SELECT '<a href="' + STR([IntValue]) + '">' + [LinkName]HTHregardsASP.NET Hosting (HostingFest) Bingo!  I had to restrict the fu...

convert string into int
How can I convert string into int? thanks in advance Leszek "leszek" <> wrote: > How can I convert string into int? iVar = Long(sVar). Isn't it obvious? Dmitri. I'd better add and isnumber() if isnumber(sVar) then iVar = Long(sVar) "Dmitri" <> wrote in message news:44eac4b7$1@forums-1-dub... > "leszek" <> wrote: > > > How can I convert string into int? > > iVar = Long(sVar). Isn't it obvious? > > Dmitri. > ...

How to convert string to int
sir, i am a beginner in and I am getting -1 when i tried to retrieve one data its datatype is int from table how i can convert a string or an object to int thanking you in advance Jazeel string s = "-1"; int i = Convert.ToInt32(s);James Wu (MIB426).NET is only way to goMCP, MCSE, MCDBA, MCSD, MCAD Convert always throws an FormatException, if the object cannot be converted. You need to make sure, the string can be converted to int, else you can try int i =0;string s = -1; bool _success = Int32.TryParse(s, out i);If the string can be converted, the value is out to...

converting int to string
How do i convert int to string? Thank you int blah = 7;string blah2;blah2 = blah.ToString();// orblah2 = Convert.ToString(blah2);HTH,RyanRyan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question...

converting from string to int
I am having a problem that it is not able to convert string to int. The nofields retrieved from QueryString of another form is of type string. do i convert a string into a int here. int nofields; nofields =Request.QueryString["Nofields"]; Panel1.Controls.Clear(); for (i=1; i==nofields; i++) { -------- ------- } nofields = Convert.ToInt32(Request.QueryString["Nofields"]); As an alternative you can use the next procedure: string thestring = ...; int val; try { val = int.Parse(thestring); } catch ...

Convert int for string
Hello, In many languages there is a function for convert int for string. Ho I can do it in Perl ? Best regards, Rodrigo Faria Flickr agora em portugu�s. Voc� clica, todo mundo v�. 2007/8/26, Rodrigo Tavares <>: > Hello, > > In many languages there is a function for convert int > for string. Ho I can do it in Perl ? > Hello, Perl isn't a strong type language like C,so you don't have the need to convert the variable type distinctly. for example, my $x = 123; print $x * 2; w...

Converting an int to a string
Hi I have an SQL Statement that will achieve a number from my Access database (it's a COUNT query) and I would like to show this as the text property of a label but understand that I have to convert it to a string first? Could anyone tell me how please ? many thanks. myInt.ToString should do it for you.JimMS MVP ASP.NET [VC++/MFC emeritus]Old Dog Learns New TricksPreferred programming language: cuneiform on clay tablets Hi, Thanks for that. Now I don't quite know how to get the figure for the count I want :-s Is this function correct? Function GetSuggestions() As System.D...

convert string to Int
I am trying to select data from a DB, but keep getting a missmatch error. I know why this is happening, but don't know how to fix it. Basically I have a form which takes in a string, in the DB the string is actually a number. How do I convert the string that was in the form to a number for the DB. EX: loginSQL = "UPDATE employees SET status = 'complete' WHERE id = "& Session("ID") Session("ID") is a string, but I want a number!!!! Thanks a alot! :) use sql function: cast(parameter as int). however, your sql string looks good. your ...

String ccomparison problem. How to convert AUTF8String (nsACString) to a regular String or vice versa
Hi, I'm having trouble comparing strings of different types in Java Script The two strings are equal when displayed in an alert popup but the "==" condition fails The two types are the following 1. nsIURI.spec and 2. i receive a URL through and attempt to compare it with nsIURI.spec In this sample code, i pass in the as the "url" parameter, which is then compa...

converting a string to an int
I've tried  Convert.ToInt32(strYear); DateTime theDate = new DateTime(intMonth, strYear, strDay);  but I'm still getting a Argument '2': cannot convert from 'string' to 'int' error, anyone know whats going wrong? thanks   HItry this:int i = i.Parse(strYear); Please remember to click "Mark as Answer" on this post if it helped you. got it sorted, need to assign the convert.toint32(string) to an integer, likeint a = Convert.ToInt32(stringb);  how you get the value of strYear? you sure it&#...

converting string to int?
I have a class that has... private int _PersonID; I want to store a value from the ds.... this._PersonID = ds.Tables[0].Rows[0]["id"].ToString(); When I try to compile, I get: "Cannot implicitly convert type 'string' to 'int'" I've tried... this._PersonID = (int)ds.Tables[0].Rows[0]["id"].ToString(); Get the same error. I've also tried... this._PersonID = (int)ds.Tables[0].Rows[0]["id"]; Get "Cannot implicitly convert type 'object' to 'int'" Any suggestions? use the convert class. this._PersonID = Convert.ToInt32(ds.Tables[0].Rows[0]["id"]);cheers :: thomas Thank...

Web resources about - converting string to small int problem -

Facebook Begins Converting Users To HTTPS
Are you willing to sacrifice a little bit of speed for a lot more safety? Facebook is asking that very question with its announcement that it ...

Facebook No Longer Converting Groups Into Pages
Back when Facebook first launched Facebook Pages, many businesses and brands who had built up substantial audiences in their Facebook Groups ...

Vert - simply converting for iPhone, iPad, and iPod touch on the iTunes App Store
Get Vert - simply converting on the App Store. See screenshots and ratings, and read customer reviews.

Converting SIM Card to Micro SIM Card - Flickr - Photo Sharing!
Place new Micro SIM into the iPhone SIM card tray

Ayaan Hirsi Ali on Converting Muslims to Christianity - YouTube
Complete video at: Ayaan Hirsi Ali explains her support of missionary ...

Click go fears of converting print files
Is there a way to convert a print queue item to a .RTF or .PDF file? I like to save or email them. - The Sydney Morning Herald

Sudanese woman ordered to hang under sharia law for converting to Christianity gives birth
Khartoum, Sudan: A Christian Sudanese woman sentenced to hang for apostasy has given birth in jail, a Western diplomat said on Tuesday.

Imams warn against radicalism to Aboriginal inmates converting to Islam
The prison system has enlisted the help of ASIO to crack down on radicalisation behind bars amid revelations that Aboriginals are converting ...

Converting the world's companies one by one - The Science Show - ABC Radio National (Australian Broadcasting ...
Image: Trucks carrying logs make their way up a road in Jambi, Indonesia. A vast area of the Sumatran forest, and orangutan habitat, is being ...

Converting Churches Into Homes Is The Latest Hollywood Trend
You don't have to be a believer to be moved by the beauty of a church.

Resources last updated: 12/11/2015 9:04:28 AM