标题:实时 3001 参数类型不正确 或不在可以接受的范围之内或于其他参数 ...
取消只看楼主
tcapple486
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2007-4-19
 问题点数:0 回复次数:1 
实时 3001 参数类型不正确 或不在可以接受的范围之内或于其他参数冲突
Private Sub Form_Load()
Dim sql_shuju As String
Dim sql_jiage As String
sql_shuju = "select * from 用户基本信息"
rs_shuju.Open sql_shuju, conn------------------------------------报错语句
sql_jiage = "select * from 水电气价格表"
rs_jiage.Open sql_jiage, conn
End Sub

Dim rs_shuju As New ADODB.Recordset
Dim rs_jiage As New ADODB.Recordset 这在通用中

数据库的连接在 上一个窗口中定义了 而且成功通过
搜索更多相关主题的帖子: 参数 实时 数据库 shuju jiage 
2007-05-01 18:48
tcapple486
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2007-4-19
得分:0 

现在具体讲我的代码:
Dim user As String, pwd As String
Dim conn As ADODB.Connection
Dim r As ADODB.Recordset 在form窗体中的通用中定义
#################################################
Private Sub Command1_Click()

Set r = New ADODB.Recordset
Dim strsql As String
user = txtuser
pwd = txtpwd
strsql = "select * from yonghu where name='" & user & "'and pwd='" & pwd & "'"
r.Open strsql, conn
If r.EOF Then
MsgBox "登陆失败"
Else
MsgBox "登陆成功"
Unload Me
Form2.Show
r.Close
End If
End Sub


-------------------------------------------
Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()

Set conn = New ADODB.Connection
conn.ConnectionString = "driver={sql server};server=dengjiaxiong;uid=sa;pwd=;dataname=school"

conn.Open

If conn.State = adStateOpen Then
MsgBox "connection successfull!"

End If
End Sub

--------------------------------------------
Private Sub Label1_Click()
txtuser = ""
txtpwd = ""
End Sub

#########################################在form中定义
以下为第二个form窗体
Dim rs_shuju As New ADODB.Recordset
Dim rs_jiage As New ADODB.Recordset 在通用中定义
————————————————--------
Private Sub Command1_Click()
Dim strsql As String
user = txtuser
pwd = txtpwd
strsql = "select * from yonghu where name='" & user & "'and pwd='" & pwd & "'"
r.Open strsql, conn
Set DataGrid1.DataSource = r
End Sub

Private Sub Command2_Click()
txtuser = ""
txtpwd = ""
txtuser.SetFocus
End Sub

Private Sub Command3_Click()
If Text4.Text = "" Then
MsgBox "id不能空!"
Text4.SetFocus
End If
rs_shuju.AddNew
rs_shuju.Fields(0) = Val(Text4.Text)
rs_shuju.Fields(1) = Text5.Text
rs_shuju.Fields(2) = Val(Text6.Text)
rs_shuju.Fields(3) = Val(Text7.Text)
rs_shuju.Fields(4) = Val(Text8.Text)
rs_shuju.Fields(5) = Val(Text9.Text)
rs_shuju.Update
End Sub

Private Sub Command6_Click()
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text4.SetFocus

End Sub

Private Sub DataGrid1_Click()

End Sub

Private Sub Form_Load()
Dim sql_shuju As String
Dim sql_jiage As String
sql_shuju = "select * from p123"
rs_shuju.Open sql_shuju, -----------------------------------语句报错行 提示 实时 3001 参数类型不正确 或不在可以接受的范围之内或于其他参数冲突
connsql_jiage = "select * from 水电气价格表"
rs_jiage.Open sql_jiage, conn
End Sub

在第二个窗体中定义
----------------------------

2007-05-02 21:38



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-136451-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.034016 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved