表1表2中的记录插入表3中
来源:互联网 发布:鞋子淘宝店 编辑:程序博客网 时间:2024/06/01 10:10
protected void btnOk_Click1(object sender, EventArgs e)
{
string strCon = ConfigurationManager.ConnectionStrings["TPVConnectionString"].ToString();
SqlConnection con = new SqlConnection(strCon);
con.Open();
string strSql = "select * from[USER] where [LOGONID]='"+txtAD.Text.Trim()+"'";
SqlCommand com = new SqlCommand(strSql,con);
SqlDataReader dr = com.ExecuteReader();
if(dr.Read())
{
string strconn = ConfigurationManager.ConnectionStrings["TPVConnectionString"].ToString();
SqlConnection conn = new SqlConnection(strconn);
conn.Open();
lblName.Text=dr["USERNAME"].ToString();
lblName.Visible = true;
string strSqlInsert = @"insert into [GROUPUSER](USERID,GROUPID) select [USER].USERID , [GROUP].GROUPID from [USER],[GROUP]
where GROUPNAME='"+ddlGroup.SelectedValue+"' and USERNAME='"+lblName.Text+"'";
SqlCommand comm = new SqlCommand(strSqlInsert,conn);
comm.ExecuteNonQuery();
conn.Close();
Response.Write("<script>alert('添加权限成功!');</script>");
}
else
{
lblName.Text = "不存在此AD!";
lblName.Visible = true;
btnOk.Enabled = false;
}
con.Close();
}
- 表1表2中的记录插入表3中
- 向表中插入多条记录
- 循环向表中插入记录
- Qt 数据库表中插入记录
- Oracle插入表中不存在的记录
- mysql表中不存在记录则插入否则更新记录
- 使用insert向一个表中插入其他表中的多条记录
- 如何解决在asp中不能对access数据库中的表进行插入记录问题
- 表中的某些记录插入到另外一个表
- 分解字符串 插入表中 如 1,2,3 相当于 C#中的 Split 方法
- 查询在表1中存在,在表2中不存在的记录,将其插入表2
- oracle 9i向表中插入多行记录
- SQL获取表中最新插入的记录
- oracle快速向表中插入记录方法
- Mysql复制一条记录插入到当前表中
- SQL 选择刚插入的一条记录插入到另一个表中
- ACCESS的真假:三、往一个表中插入10万条记录的速度小于插入1万条记录吗?
- oracle触发器 判断插入的记录是否满足条件,如果满足,则在b表中插入相应记录
- WCF 一步一步 发布 WCF服务 到 IIS
- iOS sqlite3 数据库的操作
- 当Win7 安装 SQl Server 2005后Windows身份验证无法登陆时
- mysql主从复制,半同步,主主复制架构的实现
- Java内存泄露
- 表1表2中的记录插入表3中
- PPT新视角——VBA应用技术
- 自动安装apk
- yingwen
- UVa 11584 - Partitioning by Palindromes 回文串dp
- 使用FFMPEG合并视频
- int *p[4]和 int (*q)[4]的区别
- 页面跳转
- jni动态注册