社区
ASP
帖子详情
为什么rs1.Open strSelect1,conn,adOpenStatic行,而rs1.Open strSelect1,conn,adOpenStatic,adLockOptimistic就不行
陈小弟110
2003-03-11 11:36:32
RT
...全文
47
3
打赏
收藏
为什么rs1.Open strSelect1,conn,adOpenStatic行,而rs1.Open strSelect1,conn,adOpenStatic,adLockOptimistic就不行
RT
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
陈小弟110
2003-03-12
打赏
举报
回复
谢谢了
我的问题解决了
逍遥小贼
2003-03-11
打赏
举报
回复
我觉得是你的常量定义的问题,你的定义(或者定义文件)中是否定义了
Const adLockOptimistic
逍遥小贼
2003-03-11
打赏
举报
回复
<%
'定义数据库连接的一些常量
Const adOpenForwardOnly = 0 '(默认值)游标只向前浏览记录,不支持分页、Recordset、BookMark
Const adOpenKeyset = 1 '键集游标,其他用户对记录说做的修改将反映到记录集中,但其他用户增加或删除记录不会反映到记录集中。支持分页、Recordset、BookMark
Const adOpenDynamic = 2 '动态游标功能最强,但耗资源也最多。用户对记录说做的修改,增加或删除记录都将反映到记录集中。支持全功能浏览(ACCESS不支持)。
Const adOpenStatic = 3 '静态游标,只是数据的一个快照,用户对记录说做的修改,增加或删除记录都不会反映到记录集中。支持向前或向后移动
Const adLockReadOnly = 1 '(默认值)锁定类型,默认的,只读,不能作任何修改
Const adLockPessimistic = 2 '当编辑时立即锁定记录,最安全的方式
Const adLockOptimistic = 3 '只有在调用Update方法时才锁定记录集,而在此前的其他操作仍可对当前记录进行更改、插入和删除等
Const adLockBatchOptimistic = 4 '当编辑时记录不会被锁定,而更改、插入和删除是在批处理方式下完成的
Const adCmdText = &H0001
Const adCmdTable = &H0002
%>
Open 方法 (ADO Recordset)
打开游标。
语法
recordset.Open Source, ActiveConnection, CursorType, LockType, Options
C# 手机销售系统
using System; using System.Data; using System.Data.SqlClient; using System.Collections; namespace mobilesale { ///
/// DataBL 的摘要说明。 ///
public class DataBL { public DataBL() { // // TODO: 在此处添加构造函数逻辑 // } public
static
Sql
Conn
ection get
Conn
() { Sql
Conn
ection sqlCon= new Sql
Conn
ection("server=.;Integrated Security=SSPI;Database=MTSSystem"); return sqlCon; } public
static
DataTable
select
Mobile() { Sql
Conn
ection con=DataBL.get
Conn
();
Str
ing
str
Select
="
select
mobileModelID as '手机编号',mobileModel as '手机型号',mobileFactory as '手机厂家',totalPrice as '手机全价',maxDisccunt as '最大折扣' from mobileModel"; SqlData
Ad
apter
ad
apter=new SqlData
Ad
apter(
str
Select
,con); DataTable tab=new DataTable();
ad
apter.Fill(tab); return tab; } public
static
DataTable
select
Sales() { Sql
Conn
ection con=DataBL.get
Conn
();
Str
ing
str
Select
="
select
saleID as '营业员编号',saleName as '姓名',salesVolume as '销售额' from mobileSales"; SqlData
Ad
apter
ad
apter=new SqlData
Ad
apter(
str
Select
,con); DataTable tab=new DataTable();
ad
apter.Fill(tab); return tab; } public
static
ArrayList
select
SaleNames() { Sql
Conn
ection con=DataBL.get
Conn
();
Str
ing
str
Select
="
select
saleName as '姓名'from mobileSales"; SqlCommand cmd=new SqlCommand(
str
Select
,con); con.
O
pen
(); SqlDataRe
ad
er re
ad
er=cmd.ExecuteRe
ad
er(); ArrayList data=new ArrayList(); while(re
ad
er.Re
ad
()) { data.
Ad
d(re
ad
er.Get
Str
ing(0)); } con.Close(); return data; } public
static
ArrayList
select
MobileModel() { Sql
Conn
ection con=DataBL.get
Conn
();
Str
ing
str
Select
="
select
mobileModel as '手机型号'from mobileModel"; SqlCommand cmd=new SqlCommand(
str
Select
,con); con.
O
pen
(); SqlDataRe
ad
er re
ad
er=cmd.ExecuteRe
ad
er(); ArrayList data=new ArrayList(); while(re
ad
er.Re
ad
()) { data.
Ad
d(re
ad
er.GetValue(0)); } con.Close(); return data; } public
static
ArrayList
select
Disccunt(
str
ing mobileModel) { Sql
Conn
ection con=DataBL.get
Conn
();
Str
ing
str
Select
="
select
maxDisccunt from mobileModel where mobileModel='"+mobileModel+"'"; SqlCommand cmd=new SqlCommand(
str
Select
,con); con.
O
pen
(); int maxDisccunt=Int32.Parse( cmd.ExecuteScalar().To
Str
ing()); con.Close(); ArrayList data=new ArrayList(); for(int i=maxDisccunt;i<=100;i++) { data.
Ad
d(i); } return data; } public
static
Str
ing setPrice(
str
ing mobileModel,
str
ing count,
str
ing disccunt) { Sql
Conn
ection con=DataBL.get
Conn
();
Str
ing
str
Select
="
select
totalprice from mobileModel where mobileModel='"+mobileModel+"'"; SqlCommand cmd=new SqlCommand(
str
Select
,con); con.
O
pen
(); int maxDisccunt=Int32.Parse( cmd.ExecuteScalar().To
Str
ing()); con.Close(); return (maxDisccunt*Int32.Parse(count)*Int32.Parse(disccunt)/100).To
Str
ing(); } public
static
int insertOrder(
str
ing saleName,
str
ing mobileModel,
str
ing customer,
str
ing IDCardNo,
str
ing amount ,
str
ing price) { Sql
Conn
ection con=DataBL.get
Conn
();
Str
ing
str
Select
="
select
saleID from mobileSales where saleName='"+saleName+"'"; SqlCommand cmd=new SqlCommand(
str
Select
,con); con.
O
pen
(); int saleId=Int32.Parse( cmd.ExecuteScalar().To
Str
ing()); con.Close();
str
Select
="
select
mobileModelID from mobileModel where mobileModel='"+mobileModel+"'"; cmd=new SqlCommand(
str
Select
,con); con.
O
pen
(); int mobileModelID=Int32.Parse( cmd.ExecuteScalar().To
Str
ing()); con.Close();
str
ing
str
Insert ="insert into mobileOrder values ('"+customer+"','"+IDCardNo+"',"+saleId+","+mobileModelID+","+Int32.Parse(amount)+","+Int32.Parse(price)+",'"+DateTime.Now.To
Str
ing()+"')"; cmd=new SqlCommand(
str
Insert,con); con.
O
pen
(); return cmd.ExecuteNonQuery(); con.Close(); } } }
科奥制冷网站
public partial class Manages_ManageLogins : System.Web.UI.Page { protected void Page_Lo
ad
(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { try { if (TextBox1.Text == "" || TextBox2.Text == "") { this.Page.RegisterStartupScript("ss", "<script>alert('用户名称和密码信息不能为空!')string num = this.TextBox3.Text.Trim(); if (Session["ValidNums"].To
Str
ing() == num.ToUpper()) { // 连接数据库
str
ing
Str
ad
dcon = Server.MapPath("../kocooldb.mdb"); OleDb
Conn
ection sqlcon = new OleDb
Conn
ection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" +
Str
ad
dcon); sqlcon.
O
pen
();
str
ing
str
select
= "
select
* from tb_user where username='" + TextBox1.Text.Trim() + "'"; OleDbData
Ad
apter
ad
sas = new OleDbData
Ad
apter(
str
select
, sqlcon); DataSet
ad
dss = new DataSet();
ad
sas.Fill(
ad
dss); if (
ad
dss.Tables[0].Rows.Count > 0) { //Sql
Conn
ection sqlcon = new Sql
Conn
ection(ConfigurationManager.
Conn
ection
Str
ings["
conn
ection"].
Conn
ection
Str
ing); //sqlcon.
O
pen
();
str
ing
str
select
1 = "
select
* from tb_user where username='" + TextBox1.Text.Trim() + "' and pwd='" + TextBox2.Text.Trim() + "'"; OleDbCommand sqlcmd1 = new OleDbCommand(
str
select
1, sqlcon); OleDbDataRe
ad
er dr1 = sqlcmd1.ExecuteRe
ad
er(); if (dr1.Re
ad
()) { //Request["userid"] = dr1["id"].To
Str
ing(); Session["username"] = TextBox1.Text; Response.Redirect("Manages.aspx"); } else { this.Page.RegisterStartupScript("ss", "<script>alert('密码错误!')
经典JS三级联动表单
JS三级联动表单
ASP
28,390
社区成员
357,068
社区内容
发帖
与我相关
我的任务
ASP
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
复制链接
扫一扫
分享
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章