gridview中的数据类型错误 [英] datatypes errors in gridview

查看:96
本文介绍了gridview中的数据类型错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

海,


我在更新过程中对gridview有一些怀疑.假设我们使用ID列作为sql server中的主键,这意味着在更新过程中我们的gridview编码中我们写为

Hai,


I have some doubts in gridview during updating.Suppose we use ID column as a primary key in sql server.It means in our gridview coding during updating we write as

cmd.Parameters.Add("@ID",SqlDbType.Int).Value =Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[1].Text);



对于varchar



and for varchar

cmd.Parameters.Add("@NAME", SqlDbType.VarChar).Value = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;

.

我的疑问是,如果我们在SQL Server数据库中使用薪水列,就必须使用money.我们如何在更新部分的gridview中进行此编码.还要plz告诉我datetime数据类型.

.

My doubt is if we are using salary column in sql server database we have to use money.How can we do this coding in gridview during updation part.And also plz tell me for datetime datatype.

推荐答案

对于Money,请以十进制或浮点数表示,并
对于datetime,您可以使用DateTime.MinValue.ToLongTimeString()或
DateTime.MaxValue.ToLongTimeString()
For Money take it in decimal or float and
for datetime you can take DateTime.MinValue.ToLongTimeString() or
DateTime.MaxValue.ToLongTimeString()


Sql datetime数据类型 [ ^ ]
数据类型差异 [金钱和小钱(Transact-SQL) [
Sql datetime datatype[^]
Data Type Differences[^]
If you are using sql 2008
money and smallmoney (Transact-SQL)[^]


这篇关于gridview中的数据类型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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