mycommand=new oledbDataAdapter("select * from tbledit where edit="+Session("用户名").ToString())
-------------------------
这句应该这样来写吧
mycommand=new oledbDataAdapter("select * from tbledit where edit="+Session("用户名").ToString(),conn);
to wggwan(明天会更好):
谢谢您的帮助,我将您提供的代码修改如下,但提示如下信息:
类型“String”的值无法转换为“System.Data.OleDb.OleDbCommand”。
请问如何修改啊,再次打扰,实在不好意思!代码如下:
Sub Page_Load(sender As Object, e As EventArgs)
'记录用户名,并显示
if not (Session("用户名") is nothing) then
Label1.Text = "<b>欢迎" & Session("用户名") & "登录!</b>"
else
label1.text="欢迎~~~~欢迎!"
end if
dim ds as dataset=new dataset
dim conn as oledbconnection
conn=new oledbconnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&server.mappath("/qkglxt/data/data.mdb"))
dim mycommand as oledbDataAdapter
mycommand=new oledbDataAdapter("select * from tbledit where edit="+Session("用户名").ToString())
conn.open()
mycommand.fill(ds)
grdmain.datasource=new dataview(ds.tables(0))
grdmain.databind()
end sub