if Not IsPostBack Then
conn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&server.mappath("xxx/xxx.mdb"))
conn.open()
cmd=new OleDbcommand("select *from 用户管理 where 用户名='"&name.text&"'",conn)
rs=new OleDbdatareader
rs=cmd.executereader()
if rs.read() then
msgbox("此用户名已经存在!")
name.text=""
name.focus
else
end if
运行后出现以下错误:
Compiler Error Message: BC30455: Argument not specified for parameter 'connection' of 'Public Sub New(cmdText As String, connection As System.Data.OleDb.OleDbConnection, transaction As System.Data.OleDb.OleDbTransaction)'.
conn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&server.mappath("xxx/xxx.mdb"))
conn.open()
cmd=new OleDbcommand("select *from 用户管理 where 用户名='"&name.text&"'",conn)
rs=new OleDbdatareader
rs=cmd.executereader()
if rs.read() then
msgbox("此用户名已经存在!")
name.text=""
name.focus
else
end if
运行后出现以下错误:
Compiler Error Message: BC30455: Argument not specified for parameter 'connection' of 'Public Sub New(cmdText As String, connection As System.Data.OleDb.OleDbConnection, transaction As System.Data.OleDb.OleDbTransaction)'.
解决方案 »
- 应用母版页的链接问题
- 这个问题有待研究下。
- 实体类是bool型如何在页面显示汉字?
- 关于用.net 将Excel文件导入到数据库(MSSQL)的问题
- 在线等急!!! vss 代码管理 部署 服务器
- innerText问题!!!
- (在线等了)未能加载文件或程序集“fangcao.WebControls”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)
- 字符串输出过程中处理出现如下错误:
- .net 连接oracle不上,但用plSLQ可以连上
- 初学asp.net问一个初级的问题
- 毕业设计做完了,希望大家提提意见
- 应用C#在WEB上画折线图
if Not IsPostBack Then
Dim conn As New OleDbConnection()
conn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&server.mappath("xxx/xxx.mdb"))
conn.open()
Dim cmd As New OleDbcommand()
cmd=new OleDbcommand("select *from 用户管理 where 用户名='"&name.text&"'",conn)
Dim rs As New OleDbdatareader()
rs=cmd.executereader()
if rs.read() then
msgbox("此用户名已经存在!")
name.text=""
name.focus
else
end if
把上面的路径输出看看是否正确。
运行后出现以下错误:
Compiler Error Message: BC30455: Argument not specified for parameter 'connection' of 'Public Sub New(cmdText As String, connection As System.Data.OleDb.OleDbConnection, transaction As System.Data.OleDb.OleDbTransaction)'.
dim a as string
a=name.text
cmd=new OleDbcommand("select *from 用户管理 where 用户名='"&a&"'",conn)
Dim conn As OleDbConnection
conn="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & server.mappath("xxx/xxx.mdb")
conn.open()
Dim cmd As OleDbcommand=new oledbcommand("select * from 用户管理 where 用户名='"&name.text&"'",conn)Dim rs As New OleDbdatareader()
rs=cmd.executereader()
if rs.read() then
msgbox("此用户名已经存在!")
name.text=""
name.focus
else
end if
Dim cmd As OleDbCommand
Dim rs As OleDbDataReader
If Not IsPostBack Then
conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("grade.mdb"))
conn.open()
cmd = New OleDbCommand("select *from books where itemid='1'", conn)
rs = cmd.executereader()
If rs.read() Then
'MsgBox("此用户名已经存在!")
'name.text = ""
'name.focus()
Else
End If
End If
conn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&server.mappath("xxx/xxx.mdb"))
conn.open()
cmd=new OleDbcommand("select *from 用户管理 where 用户名='"&name.text&"'",conn)
rs=new OleDbdatareader
rs=cmd.executereader()
if rs.read() then
msgbox("此用户名已经存在!")
name.text=""
name.focus
else
end if
改为:
If Not IsPostBack Then
Dim conn as new OledbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source="& Server.MapPath("xxx/xxx.mdb"))
Dim comm as new OledbCommand("Select * From 用户管理 where 用户名='"& name.text.Trim.ToString() &"'",Conn)
Try
Conn.Open()
Dim dr as OledbDataReader=comm.ExecuteReader()
if dr.Read() Then
msgbox("此用户名已经存在!")
name.text=""
Else
'other code
End If
Catch ex as Exception
Response.Write("错误信息:" & ex.Message)
Finally
conn.Close()
End Try
End If
conn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&server.mappath("data/data.mdb"))
conn.open()
cmd=new OleDbcommand("select * from 用户管理 where 用户名='"& na.text &"'",conn)
rs=cmd.executereader()
if rs.read() then
msgbox("此用户名已经存在!")
na.text="ok"
na.focus
else
msgbox("增加成功!")
end if
conn.close
就是当我点击FORM的的REG按钮时,应该执行
if Not IsPostBack Then
conn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&server.mappath("data/data.mdb"))
conn.open()
cmd=new OleDbcommand("select * from 用户管理 where 用户名='"& na.text &"'",conn)
rs=cmd.executereader()
if rs.read() then
msgbox("此用户名已经存在!")
na.text="ok"
na.focus
else
msgbox("增加成功!")
end if
conn.close
代码,但是,我测试后发现程序确没有执行
if Not IsPostBack Then
end if
之间的代码,这是怎么回事?
然后你双击这个控件,转入.aspx.vb的Button的Click事件下了.你将以上代码写到Button的Click事件下.能不执行吗?应给是不会的...如果还有问题,发消息给我.
我在
if Not IsPostBack Then
end if
之上写了一段程序就可以执行,但放在里面就不执行了还有,按钮调用CLICK函数的代码是不是这么写
<asp:Button ID="regButton" runat="server" Text="注册" OnClick="regButton_Click"/>
其中regButton_Click就是函数名