这样行吗?Set mrc = cn.Execute("select * from dingdan where shijian>= '" & Form10.dbegindate & "'and shijian<='" & Form10.denddate & "'") dbegindate和denddate是我在Form10里面定义的两个参数。Dim denddate As String、Dim dbegindate As String 但是运行时的错误是:未找到方法或数据成员! 这两个在这个窗体里要不要再定义一次?
dim db as adodb.connection dim rec as adodb.recordersetCONNSTR = "Driver={SQL Server};Server=" & localhost & ";UID= ;PWD= ;DATABASE=" & db.Open CONNSTR Set REC = New Recordset REC.Open ""select * from 订单 where 业务员=" & form1.text(combo1.text) ", db, adOpenStatic, adLockOptimistic
dbegindate = Format(CDate(Comboy(0) & Combom(0) & "-1"), "yymmdd")
denddatetemp = DateAdd("d", -1, DateAdd("m", 1, DateSerial(CInt(Comboy(1)), CInt(Combom(1)), 1)))
denddate = Format(dendatetemp, "yymmdd")
还有我没有有用adodc1
我用的是对象编程
像一个是2000另外一个03
我要将它们组成2000-03-01
因为我数据库的表的查询的的字段的格式是2000-03-01
大家能够明白我说的吗?
谢谢!
dbegindate和denddate是我在Form10里面定义的两个参数。Dim denddate As String、Dim dbegindate As String
但是运行时的错误是:未找到方法或数据成员!
这两个在这个窗体里要不要再定义一次?
dim rec as adodb.recordersetCONNSTR = "Driver={SQL Server};Server=" & localhost & ";UID= ;PWD= ;DATABASE=" &
db.Open CONNSTR
Set REC = New Recordset
REC.Open ""select * from 订单 where 业务员=" & form1.text(combo1.text)
", db, adOpenStatic, adLockOptimistic
在查询窗体中的两个combo是先从表中显示其时间,将“yyyy”和“mm”分开。用Set mrc = cn.Execute("select distinct datepart(yy,shijian) from dingdan")
然后在将这两个合起来再做查询条件。
其实这个都是为了用户方便,如果不用combo的话,直接用个text就可以叫他们去输。但是我想那样的话用户用起来不方便。
你能看的懂我讲的吗?我的qq是30924915
select ... from .. where year(时间)=combo1.text and month(时间)=combo2.text然后将该查询字符串传给第二个窗体
Sqlstr="select ... from .. where year(时间)=" &combo1.text &" and month(时间)=" &combo2.text
month(时间)是取出月份
form1.combo1.text
或设置一个窗体模块级的全局变量,访问时用以下方法如在两个窗休中都用Sqlstr作为变量的话
Sqlstr=form1.Sqlstr
运行出现的错误提示:类型不匹配
搞的我好象头晕了
Set mrc = cn.Execute("select * from dingdan where shijian Like '" & Trim(Form10.Comboy(0).Text) & " - " & Trim(Form10.Combom(0).Text) & "'and shijian<='" & Trim(Form10.Comboy(1).Text) & " - " & Trim(Form10.Combom(1).Text) & "'%")
Set mrc = cn.Execute("select * from dingdan where shijian Like '" & Trim(Form10.Comboy(0).Text) & " - " & Trim(Form10.Combom(0).Text) & "% "
百思不得其解
Set mrc = cn.Execute("select * from dingdan where shijian>= '" & Trim(Form10.Comboy(0).Text) & "-" & Trim(Form10.Combom(0).Text) & "'and shijian<='" & Trim(Form10.Comboy(1).Text) & "-" & Trim(Form10.Combom(1).Text) & "'")