怀疑c#中的webservices [英] Doubt in webservices in c#

查看:57
本文介绍了怀疑c#中的webservices的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai Guys

我对c#.net + asp.net webservices有一个疑问,我有三个这样的文本框

Textbox1 EmpId only Int like 123

TextBox2仅限Empname String喜欢sandeep,Miriyala,

TextBox3 EmpSalary只有6543.50的双倍跟随

提交时我有一个疑问



Webservices将收集



我的网络服务如下



EmpId-> TextBox1.value

EmpName-> TextBox2.value

EmpSal-> TextBox3.value

什么是用户将进入我发送到webservices方法的文本框我的webservices方法如下..

我知道默认值在asp文本框中由用户输入是字符串格式只是需要再次转换和再次在我的网站服务....



Hai Guys
I have one doubt in c#.net +asp.net webservices , I have three text boxes like this
Textbox1 EmpId only Int like 123
TextBox2 Empname only String likes sandeep, Miriyala,
TextBox3 EmpSalary only double like 6543.50 paise follows
I have one doubt while submiting buttion

Webservices will collected

My webservices is as follows

EmpId->TextBox1.value
EmpName->TextBox2.value
EmpSal->TextBox3.value
what are the user will entered the textbox I am sending to webservices method My webservices method is as follows..
I know that By default value in asp textboxes enter by user is String format only is it requied to convert again and again in my webservices ....

protected string  AddDetails(int EmpId, String  Empname, Double Empsal)
{

String FinalResult;
FinalResult=Convert.ToInt32(EmpId)+Empname+Convert.Todouble(Empsal);
return FinalResult;
}





是否需要将文本框值转换为String如果需要如何将Double数据类型转换为String数据类型给我一些基本的例子我面临将双重转换为字符串的问题,请帮助我。





谢谢& Regrads

Sandeep Miriyala



Is it required to convert the textboxes values to String if it is required How to convert Double datatype to String datatype Gave me some basic example I am facing some problem converting the double to string , Please help me.


Thanks& Regrads
Sandeep Miriyala

推荐答案

嗨Sandeep,



查看以下示例:

Hi Sandeep,

Check out the following example:
string FormattedSalary = Empsal.ToString("C2"); 



会将您的工资字段转换为代表货币值的字符串,例如:

如果Empsal = 6346.47231

you将获得:


will convert your salary field to a string representing a currency value e.g.:
if Empsal = 6346.47231
you will get: "


6346.47(根据课程的本地化)



干杯,

Edo
6346.47" (according to the localization of course)

Cheers,
Edo


我得到了解决方案默认情况下HTML Textbox把它当作String数据类型,那个原因,我可以改变方法,String数据类型。我改变方法如下,根据我的观点来看它是正确的





protected string AddDetails(String EmpId,String Empname ,String Empsal)

{



String FinalResult;

FinalResult = EmpId + Empname + Empsal;

返回FinalResult;

}



这里不需要将double转换为string,int转换为string。

谢谢和重拍

Sandeep M
I got the solution By default HTML Textbox take it as String data type, that reason, I can changed method, String data type. I changed the method is as follows, according to my point of view it is correct


protected string AddDetails(String EmpId, String Empname, String Empsal)
{

String FinalResult;
FinalResult=EmpId+Empname+Empsal;
return FinalResult;
}

here no needed to typecast the double to string , int to string.
Thanks &Regrads
Sandeep M


这篇关于怀疑c#中的webservices的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆