社区
C#
帖子详情
简单问题,在线等待!C#中string 类型转为int 类型如何转?
认真生活快乐工作
2003-07-25 05:04:57
C#中string 类型转为int 类型如何转?
还有C#中,如何将Datatime 类型转化为 String类型。
问一下,sqlserver中Datatime 类型的格式 是怎样的?
谢谢了。
我在杭州。
...全文
1196
16
打赏
收藏
简单问题,在线等待!C#中string 类型转为int 类型如何转?
C#中string 类型转为int 类型如何转? 还有C#中,如何将Datatime 类型转化为 String类型。 问一下,sqlserver中Datatime 类型的格式 是怎样的? 谢谢了。 我在杭州。
复制链接
扫一扫
分享
举报
写回复
配置赞助广告
16 条
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
打赏红包
erigido
2003-07-25
打赏
举报
回复
up
yanglg
2003-07-25
打赏
举报
回复
Convert.ToInt16();
zdsa
2003-07-25
打赏
举报
回复
string s;
int i=Convert.ToInt32(s);
DataTime dd;
string day=dd.Tostring();
如果你数据库设的日期的响应字段是DateTime.直接以字符串存入即可,SQL会自动转换。例如
string dd=System.DateTime.Now.Tostring ;//将当前时间转换为字符串
insert into table(DATATIME) values(dd)
captain2651
2003-07-25
打赏
举报
回复
System.Convert.to?下面有好多
panyee
2003-07-25
打赏
举报
回复
提交日期的sql:
insert into table (MyDate) values ('2003-7-25 19:05:10')
panyee
2003-07-25
打赏
举报
回复
C#中string 类型转为int 类型如何转?
: int i = Convert.ToInt32("245");
还有C#中,如何将Datatime 类型转化为 String类型。
: string strDate = DateTime.Now.ToString();
问一下,sqlserver中Datatime 类型的格式 是怎样的?
: sql server中的DateTime类型的格式一般是 2003-7-25 19:05:05
读出来的时候可以用
ds.Tables[0].Rows[0]["MyDate"].ToString(); 取得它的字符串值
也可以 .ToString("yyyy-MM-dd") 取得 2003-07-25这种日期格式
认真生活快乐工作
2003-07-25
打赏
举报
回复
SQLserver2000中Datatime 类型的字段格式 是怎么样的
如何提交上去
tongzhenhua
2003-07-25
打赏
举报
回复
偶也是杭州的。刚开始学C#。没办法。BCB/delphi不让用。
认真生活快乐工作
2003-07-25
打赏
举报
回复
谢谢大家,我试试
mxyqxh
2003-07-25
打赏
举报
回复
好象在俺们的C# ASP。NET 里,int .parse() 不好用噢
yahoolv
2003-07-25
打赏
举报
回复
为什么不建议用int.Parse(s)
superryu
2003-07-25
打赏
举报
回复
用Convert类的方法就可以
qimini
2003-07-25
打赏
举报
回复
建議不要用int.Parse
xupc
2003-07-25
打赏
举报
回复
string To int
int i=int.Parse(s)
DataTime to String
DataTime.ToString()
rouser
2003-07-25
打赏
举报
回复
string s = "123";
int i = Convert.ToInt32(s);
int j = Int32.Parse(s);
string ss = DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss");
// ss = "2003-7-25 17:06:06";
ETstudio
2003-07-25
打赏
举报
回复
int.Parse(string)
Datatime.ToString()
好象和C#是一样的吧,你只要保存为datatime然后再存储就可以了
很久没用了,也不知道第三个对不对
相关推荐
c#
编码
问题
c#
中
不能直接把
string
类型
的字符串直接
转
码,必须先把字符串
转
为
二进制流,再由二进制流
转
为
指定
类型
的字符串如下:
string
unicode
String
= "要
转
的字符串";// 要
转
的
类型
UTF8Encoding utf8 = new UTF8Encoding(); Byte[] encodedBytes = utf8.GetBytes(unicode
String
); Str
C#
关于
int
,
string
, Byte[] ,
转
换
在
C#
中
,有许多关于
类型
转
换的
问题
,比如
string
转
int
,
int
转
string
等
类型
,我就列举一些
简单
的
类型
转
换。
int
转
string
int
a = 10;
string
str = a.To
String
();
string
str1 = Convert.To
String
(a);
int
t...
C#
中
int
类型
转
string
类型
,
string
类型
转
int
类型
C#
中
int
类型
转
string
类型
,
string
类型
转
int
类型
int
类型
转
string
类型
:
int
a =10;
string
b = Convert.To
String
(a);
string
类型
转
int
类型
: 三种方法 num =
int
.Parse(str);
int
.TryParse(str, out num); num = Convert.To
Int
32(str);
C#
中
String
转
int
问题
String
转
int
主要有四种方法 1.
int
.Parse()是一种类容
转
换;表示将数字内容的字符串
转
为
int
类型
。 如果字符串为空,则抛出ArgumentNullException异常; 如果字符串内容不是数字,则抛出FormatException异常; 如果字符串内容所表示数字超出
int
类型
可表示的范围,则抛出OverflowException异常; 2. C...
c#
中
进制的
转
换
(1)十进制
转
其他二、八、十六进制可以用下面的函数“
string
To
String
(
int
value,
int
toBase);第一个参数表示十进制树,第二个是想要
转
换的
类型
例如:
string
bin= Convert.To
String
(128,2);//
转
为
2进制
string
oct=Convert.To
String
(128,8);//
转
为
8进制
string
hex=Convert.T
发帖
C#
C#
.NET技术 C#
复制链接
扫一扫
10.8w+
社区成员
64.2w+
社区内容
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
帖子事件
创建了帖子
2003-07-25 05:04
社区公告
让您成为最强悍的C#开发者