zoukankan
html css js c++ java
获得插入记录标识号, 鼠标移到DataGrid的行更改颜色(转)
转自一滴水
http://www.cnblogs.com/yidishui
获得插入记录标识号
void
Page_Load(
object
sender, System.EventArgs e)
{
//
数据库连接字符串
string
ConnStr
=
System.Configuration.ConfigurationSettings.AppSettings[
"
ConnectionSqlServer
"
];
//
创建插入SQL语句及调用@@identity函数返回标识值
string
insert_query
=
"
insert into Categories (CategoryName,Description) values ('IT', 'Internet');
"
+
"
SELECT @@identity AS 'identity';
"
;
//
执行数据库操作
SqlCommand myCommand
=
new
SqlCommand(insert_query,
new
SqlConnection(ConnStr));
myCommand.Connection.Open();
myLabel.Text
=
myCommand.ExecuteScalar().ToString();
myCommand.Connection.Close();
}
鼠标移到DataGrid的行更改颜色
private
void
DataGrid1_ItemDataBound(
object
sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if
(e.Item.ItemType
==
ListItemType.Item
||
e.Item.ItemType
==
ListItemType.AlternatingItem)
{
//
添加自定义属性,当鼠标移过来时设置该行的背景色为"6699ff",并保存原背景色
e.Item.Attributes.Add(
"
onmouseover
"
,
"
StyleColor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'
"
);
//
添加自定义属性,当鼠标移走时还原该行的背景色
e.Item.Attributes.Add(
"
onmouseout
"
,
"
this.style.backgroundColor=StyleColor
"
);
}
}
blog site
http://xiexiaokui.cnblogs.com
查看全文
相关阅读:
使用dozermapper,处理不了LocalDateTime的映射问题:java.lang.NoSuchMethodException: java.time.LocalDateTime.<init>()
mybatis-plus使用Wrapper自定义sql时出现错误:Invalid bound statement (not found)
com.baomidou.mybatisplus.core.mapper 不存在
python爬虫
DRF源码系列分析
python学习目录
脚本加载django环境
celery定时任务
用脚本创建django-orm数据库表数据
关于python很吊的一项技术!!!!!
原文地址:https://www.cnblogs.com/xiexiaokui/p/573382.html
最新文章
手册
机器学习实战 | 六 | 批量学习和在线学习
机器学习实战 | 五 | 监督式学习和无监督式学习
机器学习实战 | 四 | 机器学习系统的种类
机器学习实战 | 三 | 机器学习概览
机器学习实战 | 二 | 学习路线图
机器学习实战 | 一 | 前言
机器学习(3)数据预处理|下载数据集、加载数据集、导入数据集
机器学习(2)序言|机器学习是未来
机器学习(1)序言|机器学习的应用
热门文章
OpenCV Python 数字图像处理 基础系列(1)图像的读入、显示与保存
无法加载文件C:UsersTANGAppDataRoaming pm rm.ps1,因为在此系统上禁止运行脚本
VMware、Linux(CentOS 7)安装,供参考。
Java和C#的一些区别,不定期补充
我的spring-boot-study之mongodb的应用
我的spring-boot-study之mybatis的应用
mybatis出现Invalid bound statement (not found)
idea编译时出现错误:xx包不存在,但是代码里面不报错
atomikos分布式事务报错:The class 'com.mysql.jdbc.jdbc2.optional.MysqlXADataSource' specified by property 'xaDataSourceClassName' could not be found in the classpath
java.sql.SQLException: The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone
Copyright © 2011-2022 走看看