以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  如果使用网络数据源,自定义用户管理疑惑?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=22975)

--  作者:kunge
--  发布时间:2012/8/29 10:36:00
--  如果使用网络数据源,自定义用户管理疑惑?
    根据教程做的自定义用户管理系统,本地使用正常,现在我把数据源定向称SQL网络数据源了,现在是不是不用使用用户.MBD文件了,
直接在登录时,确定按钮改成:
Dim UserName As String = e.Form.Controls("UserName").Value
Dim
cmd As New SQLCommand
Dim
dt As DataTable
Dim
dr As DataRow
cmd.ConnectionName =
"weike"    (weike这是数据库的名字)
If
UserName = "" Then
    Messagebox.show(
"请选择用户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
End
If
cmd.CommandText =
"Select * From {Users} Where [Name] = \'" & UserName & "\'"
dt = cmd.ExecuteReader
dr = dt.DataRows(
0)
........


是不是这样的?

我已经把Users 的表定向到weike,里了

--  作者:狐狸爸爸
--  发布时间:2012/8/29 10:37:00
--  
一样的用,记得:
 
cmd.Connection Name = "数据源名称" 
 
 
不是数据库名称。
[此贴子已经被作者于2012-8-29 10:38:03编辑过]