asp 数据重复问题 同一个表 两个字段
asp 判断数据存在 传递过来的两个字段
student=session("student")
teacher=request.form("teacher")
selectid=request.form("selectid")
set msg=server.createobject("adodb.recordset")
sql2="select * from [Dv_XSXK] where student like '%" & student & "%' and KJ_ID='"&selectid&"'"
msg.open sql2,conn,3,3
if msg.eof then
Response.Write(" <script>alert('对不起,您已经选择了这门课程');location='index.asp' </script>")
else
conn.execute "insert into Dv_XSXK(KJ_ID,teacher,student) values('"&selectid&"','"&teacher&"','"&student&"')"
response.Write " <script language=javascript>alert('恭喜您,选择课程成功!');location='index.asp' </script>"
response.end
end if
我需要的是检测 传递过来的值 selectid 和 student 是否在数据库中同时存在。。
如果存在则提示,如果不存在就添加。。
添加没错误 可以 检测就不行了 网上看了很多都没用 请高手啊,,
DV_XSXK 表的字段:
XSXKID 自动 --主键
KJ_ID
teacher
student
需要判断 KJ_id 和s
相关问答:
最近在做个网上商城,购物车模块,没有做过,麻烦各位帮忙说下大致说下思路,能发一份源码更好。小弟先谢过各位了;
QQ:413763818;
eamil:swebook@126.com
网上一大堆!
www.51aspx.com
去下 ......
我想打印数据库里面读取出来的多条数据内容,实现批量打印
先导入excel或者word,然后在打印
或者购买web打印控件
使用acitvex打印。如果不需要选择属性,设置属性,就不需要商业的了。
<style media= ......
本人目前遇到一个难题,请各位高手、大侠帮帮忙。
我单击一个按钮时要把gridview中的数据一个一个的取出并把对应参数传递给前台的js。
我试了几种后台调前台的方式都没有成功,所以请大侠们帮帮小弟。
谢谢。
不 ......
protected void btnLogin_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Server = (local);user id = sa;pwd = 1;database = Login");
&nb ......
3个radioButton
一个Button
一个label
C# code:
protected void Button1_Click(object sender, EventArgs e)
{
string str = null;
RadioButton rdo=(RadioButton)sender;
......