Int 64~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

夜色镇歌 2011-12-12 12:16:41
比如说 string id = Request.QueryString["id"].ToString();

等到的是 id ="123456"

我要怎么把它变成 123456L 长整形。。。
...全文
110 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
夜色镇歌 2011-12-12
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 xinyaping 的回复:]

我觉得,第一,Convert.ToInt64这个用法,按理说你应该加一个try...catch。道理你一定明白,不解释。

第二,我觉得你应该debug一下,然后拿debug的结果来问。我们可不知道你的那个itempropsGet是什么玩艺。
[/Quote]


这样问得了。。 你就把123456 给我变成123456L
YapingXin 2011-12-12
  • 打赏
  • 举报
回复
我觉得,第一,Convert.ToInt64这个用法,按理说你应该加一个try...catch。道理你一定明白,不解释。

第二,我觉得你应该debug一下,然后拿debug的结果来问。我们可不知道你的那个itempropsGet是什么玩艺。
夜色镇歌 2011-12-12
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 xinyaping 的回复:]

引用 8 楼 a346729576 的回复:
0 0 我认识你....


....那么请问你是谁... 0 0
[/Quote]

ItemcatsGetResponse ite = ItemAPI.itempropsGet(0L);
这样传正常

Int64 _id = Convert.ToInt64(id);
ItemcatsGetResponse t = TopApiHelper.ItemAPI.itempropsGet(_id);
这样什么都得不到啊
YapingXin 2011-12-12
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 a346729576 的回复:]
0 0 我认识你....
[/Quote]

....那么请问你是谁... 0 0
YapingXin 2011-12-12
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 a346729576 的回复:]

恩 转过去我知道怎么转,可是别人的方法参数值接收 123456L这样类型的 整数后面加个L 怎么加啊
[/Quote]

你晓不晓得那个“L”的意思呀?

你分别定义一个int32值和一个int64值,然后debug一下:





你看到了吗?所谓的“L”,不就是第二个截图里面的情形吗?
夜色镇歌 2011-12-12
  • 打赏
  • 举报
回复
恩 转过去我知道怎么转,可是别人的方法参数值接收 123456L这样类型的 整数后面加个L 怎么加啊
夜色镇歌 2011-12-12
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 xinyaping 的回复:]

可以这样:

C# code

string text = "123456";
Int64 value = Convert.ToInt64(text);



也可以这样:

C# code

string text = "123456";
Int64 value;
try
{
if (!Int64.TryParse(text, out value))
{
……
[/Quote]

0 0 我认识你....
夜色镇歌 2011-12-12
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 ohkuy 的回复:]

错了,是
long i=Convert.ToInt64(id);
[/Quote]

这样得到的还是123456 不是123456L啊
YapingXin 2011-12-12
  • 打赏
  • 举报
回复
可以这样:


string text = "123456";
Int64 value = Convert.ToInt64(text);


也可以这样:


string text = "123456";
Int64 value;
try
{
if (!Int64.TryParse(text, out value))
{
// TODO - Notify that error occurs

Console.WriteLine("Error occurs while converting text to int64 value.");
}

Console.WriteLine("{0}", value);
}
catch(ArgumentException ex)
{
// TODO - Notify that error occurs

Console.WriteLine(ex.Message);
}

ohkuy 2011-12-12
  • 打赏
  • 举报
回复
错了,是
long i=Convert.ToInt64(id);
ohkuy 2011-12-12
  • 打赏
  • 举报
回复
你的数据类型“123456L”是long类型啊,
转成Int64:
Int64 i=Convert.ToInt64(id);
夜色镇歌 2011-12-12
  • 打赏
  • 举报
回复
帮忙写个转成Int64的把
夜色镇歌 2011-12-12
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 ohkuy 的回复:]

long lid=Convert.ToSingle(id);
[/Quote]

这个是float啊
ohkuy 2011-12-12
  • 打赏
  • 举报
回复
long lid=Convert.ToSingle(id);
哈哈王戈多 2011-12-12
  • 打赏
  • 举报
回复
眼镜哥说的对.............
bobye1230 2011-12-12
  • 打赏
  • 举报
回复
楼主啊,对你很无语了。。你要传的是字符,还是数字啊。如果是字符的话,你直接自己在字符串后面再加个l就行了。如果是数字的话,这个l怎么都弄不出来的。。代码里写成123456L,这个L只是要告诉编译器这是个长整型,L本身并不会存入数字当中

[Quote=引用 14 楼 a346729576 的回复:]

引用 13 楼 xinyaping 的回复:

我觉得,第一,Convert.ToInt64这个用法,按理说你应该加一个try...catch。道理你一定明白,不解释。

第二,我觉得你应该debug一下,然后拿debug的结果来问。我们可不知道你的那个itempropsGet是什么玩艺。



这样问得了。。 你就把123456 给我变成123456L
[/Quote]
夜色镇歌 2011-12-12
  • 打赏
  • 举报
回复
如果是用stringbuilder 转Int又转不过去。。愁死我了 坑爹的淘宝API
夜色镇歌 2011-12-12
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 ohkuy 的回复:]

你的数据类型“123456L”是long类型啊,
转成Int64:
Int64 i=Convert.ToInt64(id);
[/Quote]
原始的是123456 我想把它变成123456L
远程文件系统客户端源码, 超过7000行C++源代码, 其中包含RF32c.dll动态库整个工程源码, 源代码文件清单如下: \RFClient\unit_rc\CmdQueue.cpp \RFClient\unit_rc\CmdQueue.h \RFClient\unit_rc\RCClient.h \RFClient\unit_rc\RCClientObj.cpp \RFClient\unit_rc\RCClientObj.h \RFClient\units\RFCenter.cpp \RFClient\units\RFCenter.h \RFClient\units\RFCExports.cpp \RFClient\units\RFCExports.h \RFClient\units\RFCFileObj.cpp \RFClient\units\RFCFileObj.h \RFClient\units\RFCFindObj.cpp \RFClient\units\RFCFindObj.h \RFClient\units\RFConnObj.cpp \RFClient\units\RFConnObj.h \RFClient\units\RFCUtils.cpp \RFClient\units\RFCUtils.h 接口定义如下: // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* 接口相关函数 */ // 接口初始化/释放函数 void __stdcall RFCInitialize(); void __stdcall RFCUninitialize(); // 接口版本信息, 格式: "x.x.x.x (build yyyy.mm.dd)" // AVersion 返回版本号, 如: 0x0708090A 表示 7.8.9.10 char* __stdcall RFCGetVersion(long* AVersion); // 取当前操作的最后错误码(注: 用于 RFConnCreate, RFCFindFirst 和 RFCFileCreate) long __stdcall RFCGetLastError(); // 接口属性操作 long __stdcall RFCGetInt(long Attrib, long* AValue); long __stdcall RFCGetStr(long Attrib, char* AValue, long* ALen); long __stdcall RFCSetInt(long Attrib, long AValue); long __stdcall RFCSetStr(long Attrib, const char* AValue, long ALen); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* 连接的相关函数 */ // 连接创建/释放 void* __stdcall RFConnCreate(const char* AHost, long APort, const char* APassword); void __stdcall RFConnFree(void* AConnObj); // 连接打开/关闭 long __stdcall RFConnOpen(void* AConnObj); void __stdcall RFConnClose(void* AConnObj); // 连接属性操作 long __stdcall RFConnGetInt(void* AConnObj, long Attrib, long* AValue); long __stdcall RFConnGetStr(void* AConnObj, long Attrib, char* AValue, long* ALen); long __stdcall RFConnSetInt(void* AConnObj, long Attrib, long AValue); long __stdcall RFConnSetStr(void* AConnObj, long Attrib, const char* AValue, long ALen); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* 文件/目录操作的相关函数 */ // 读取/设置文件属性 long __stdcall RFCGetFileAttr(void* AConnObj, const char* AFileName, long* Attrib); long __stdcall RFCSetFileAttr(void* AConnObj, const char* AFileName, long Attrib); // 文件存在/删除/移动文件或目录 long __stdcall RFCFileExisted(void* AConnObj, const char* AFileName); long __stdcall RFCDeleteFile(void* AConnObj, const char* AFileName); long __stdcall RFCMoveFile(void* AConnObj, const char* AOldName, const char* ANewName); // 目录存在/创建/删除 long __stdcall RFCDirExisted(void* AConnObj, const char* APathName); long __stdcall RFCCreateDir(void* AConnObj, const char* APathName, bool AForced = false); long __stdcall RFCRemoveDir(void* AConnObj, const char* APathName, bool AForced = false); // 磁盘操作相关函数 long __stdcall RFCDriveType(void* AConnObj, const char* ADrive, long* AType); long __stdcall RFCDiskSpace(void* AConnObj, const char* APath, __int64* ATotalSpace, __int64* AFreeSpace); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* 文件查找的相关函数 */ void* __stdcall RFCFindFirst(void* AConnObj, const char* APath, TRFCFindItem* AItem); long __stdcall RFCFindNext(void* AFindObj, TRFCFindItem* AItem); long __stdcall RFCFindClose(void* AFindObj); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* 文件读写的相关函数 */ // 创建/释放文件对象 void* __stdcall RFCFileCreate(void* AConnObj, const char* AFileName, long AMode, bool ANeedCreate, long AFileAttr); long __stdcall RFCFileFree(void* AFile); // 读写数据 long __stdcall RFCFileRead(void* AFile, void* ABuffer, long ASize); long __stdcall RFCFileWrite(void* AFile, const void* ABuffer, long ASize); // 文件定位/清除文件缓存/设置文件末尾 long __stdcall RFCFileSeek(void* AFile, long* AOffset, long AOrigin); long __stdcall RFCFileSeek64(void* AFile, __int64* AOffset, long AOrigin); long __stdcall RFCFileFlush(void* AFile); long __stdcall RFCFileSetEOF(void* AFile); // 读取文件信息 long __stdcall RFCFileGetInfo(void* AFile, TRFCFileInfo* AInfo); long __stdcall RFCFileGetSize(void* AFile, __int64* ASize); // 读取/设置文件时间 long __stdcall RFCFileGetTime(void* AFile, double* ACreateTime, double* AModifyTime); long __stdcall RFCFileSetTime(void* AFile, const double* ACreateTime, const double* AModifyTime);

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧