将远程access数据库所在目录共享,然后用ADO方式连接到该数据库,无需WINSOCK
解决方案 »
- excel字段内容替换的问题
- 解决图片保存问题
- vb如果一个文本文件有200条记录,每条用回车换行符区别,如何提取文本文件中的后50条记录,就象数据库中提取后50条那样?!
- 怎么用VSFlexGrid 7.0去连接数据库?
- 如何解决dao控件访问Access 2000加密数据库文件出错
- VB中如何接收VC编写的dll返回的字符串?
- ~~~~~~~~~~~~~再次请问关于制作安装程序的问题~~~~~~~~~~~~~~~~``
- 急!急!急!----怎样生成.udl文件?
- 窗体拖放到其它程序的工具栏
- commondialog问题?
- 关于ADO的一个简单问题。
- ado连接。 请帮我看看,这里哪有错啊????
cn.open "provider=MS Remote;Remote Sevrer=http://www.a.com.cn"+
+";Remote Provider=msdasql;dsn=pubs"
cursorlocation设成aduseclient
cursortype=adopenstatic
locktype=lockbatchoptimistic
可不可以说具体点啊。我也是这样想的。可远程的是一个虚拟路径,找不到数据库!!你什么高招啊??
如果连接语句不好写的话,使用adodc控件就是了,从那里连接,然后ctrl+C就是了
UserMod.bas
-----------------------
Attribute VB_Name = "UserMod"Sub WinsockStatus()
If Form1.UserSock.State = sckConnected Then Form1.Label5.Caption = "Connection Established"
If Form1.UserSock.State = sckClosed Then Form1.Label5.Caption = "Connection is Closed"
If Form1.UserSock.State = sckError Then 'if there is a socket error let us know about it
Form1.Label5.Caption = "Network Sock Err"
Form1.UserSock.Close
End IfIf Form1.UserSock.State = sckInProgress Then Form1.Label5.Caption = "Connection Open"
If Form1.UserSock.State = sckConnecting Then Form1.Label5.Caption = "Connecting"If Form1.UserSock.State = 8 Then
Form1.Label5.Caption = "Connection is Closed" 'Socket is closed
Form1.ClrTxt
Form1.UserSock.Close
End IfEnd SubSub GetUsers()
On Error Resume Next
Form1.UserSock.SendData "GetUsers" ' Send a request for the contact list
End SubSub GetStuff()
On Error Resume Next
Form1.UserSock.SendData "GetStuff" ' Get other info such as if the ADO service is active
End SubSub ProcessResults(Digest As String)
On Error Resume Next
Dim Result(2) As StringResult(1) = InStr(Digest, "QRYNAME") 'Compares the incomming data if its a SQL Qry
Result(2) = InStr(Digest, "-") 'Compares the incomming data if it is a Contact List
If Result(1) >= 1 Then 'if the SQL Query result is true then Display
'the details in the text fields. (name,address,etc)
For i = 1 To 6550
processed = Split(Digest, "QRYNAME")(i)
Form1.Text1(i).Text = processed
If processed = "" Then Exit Sub
Next i
Else
If Result(2) >= 1 Then 'if the contact List is the incomming data then
'Split up the string.
For i = 0 To 6550 'Heres a limited value of the amount of records
processed = Split(Digest, "-")(i) 'that will be processed if need be. it can be higher.
If processed = "" Then Exit Sub 'When all the records have been processed end the search. With Form1.TreeView1
.Nodes.Add , tvwChild, , processed, 1 'Add the contact list to the treeview control End WithNext iElse
MsgBox "Theres a Problem with the Results " & Result(1) & " " & Result(2) 'Problem? heres the resultsEnd If: End If
End SubSub SendData(SQL As String)If Form1.UserSock.State = sckClosed Then 'if theres no connection to the server no point in sending data to it.
MsgBox "Not Connected"
Exit Sub
End If
Form1.UserSock.SendData "$" & SQL 'sends the server the Contact Name to search up in the databaseEnd SubSub SendSaveData(string1 As String, string2 As String, string3 As String, string4 As String)If Form1.UserSock.State = sckClosed Then
MsgBox "Not Connected"
Exit Sub
End IfForm1.UserSock.SendData "%" & string1 & "%" & string2 & "%" & string3 & "%" & string4 'saves the name,address,location to the current record.End Sub
frmadd.frm
--------------------------
VERSION 5.00
Begin VB.Form Form2
Caption = "Form2"
ClientHeight = 2550
ClientLeft = 60
ClientTop = 345
ClientWidth = 5445
LinkTopic = "Form2"
ScaleHeight = 2550
ScaleWidth = 5445
StartUpPosition = 3 'Windows Default
Begin VB.Frame Frame1
Caption = "New User"
Height = 2535
Left = 0
TabIndex = 0
Top = 0
Width = 5415
Begin VB.CommandButton cmdCancel
Caption = "Cancel"
Height = 375
Left = 2760
TabIndex = 8
Top = 2040
Width = 1095
End
Begin VB.CommandButton cmdSave
Caption = "Save"
Height = 375
Left = 4080
TabIndex = 7
Top = 2040
Width = 1095
End
Begin VB.TextBox Text1
Height = 285
Index = 2
Left = 1800
TabIndex = 3
Text = "Text1"
Top = 1080
Width = 3375
End
Begin VB.TextBox Text1
Height = 285
Index = 1
Left = 1800
TabIndex = 2
Text = "Text1"
Top = 720
Width = 3375
End
Begin VB.TextBox Text1
Height = 285
Index = 0
Left = 1800
TabIndex = 1
Text = "Text1"
Top = 360
Width = 3375
End
Begin VB.Label Label3
Caption = "Location"
Height = 255
Left = 240
TabIndex = 6
Top = 1100
Width = 1455
End
Begin VB.Label Label2
Caption = "Address"
Height = 255
Left = 240
TabIndex = 5
Top = 760
Width = 1455
End
Begin VB.Label Label1
Caption = "Name"
Height = 255
Left = 240
TabIndex = 4
Top = 400
Width = 1335
End
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = FalsePrivate Sub cmdCancel_Click()
Unload Me
End SubPrivate Sub cmdSave_Click()
On Error Resume Next
Form1.UserSock.SendData "~~" & Text1(0).Text & "~~" & Text1(1).Text & "~~" & Text1(2).Text & "~~"
Form1.ClrTxt
Form1.Timer2 = True
Unload Me
' sends the server the the new user details to add
End SubPrivate Sub Form_Load()
Text1(0).Text = ""
Text1(1).Text = ""
Text1(2).Text = ""
End Sub
服务器端待你up一下
-------------------------
'Written by Chris Hatton in VB 6.0.
'This is a simple example of using Winsock Client to View parts of a Microsoft Access
'database on a local machine with out having any Database Objects installed.
'Be sure to include in your project references the Microsoft
'ActiveX Data Objects 2.5 Library.
'Feel free to email me with your comments or suggestions. [email protected]
Public ServerStatus As String
Public ADOEnabled As BooleanPrivate Sub CmdADO_Click()
SendData "RemoteSTARTUP" 'this enable you to remotely activate the ado service on the server
End SubPrivate Sub CmdConnect_Click()
On Error GoTo SckErr
UserSock.Connect Text1(0).Text, 9456
Timer2.Enabled = True
Timer2.Interval = 1000
Exit SubSckErr:
Call WinsockStatusEnd SubPrivate Sub CmdDel_Click()
SendData "~" & Text1(1).Text 'sends the server the current user to delete
ClrTxt
Timer2.Enabled = True
End SubPrivate Sub CmdExit_Click()
End
End Sub
Private Sub CmdNew_Click()
If UserSock.State = sckClosed Then
MsgBox "Not Connected"
Exit Sub
End IfIf ADOEnabled = False Then 'if the database connection is avialable you cant save changes
MsgBox "ADO Connection is not Running" & vbNewLine & "Records cannot be saved"
Exit Sub
End IfForm2.Show 1
End SubPrivate Sub cmdSave_Click()
'sends the server the uptodate changes
SendSaveData Text1(1).Text, Text1(2).Text, Text1(3).Text, Text1(4).Text
End SubPrivate Sub Form_Load()
ClrTxt ' Clear Text Boxes
Label5.Caption = ""
Text1(0).Text = UserSock.LocalIP 'this is optional to have the local ip as the default server ip
ServerStatus = Label4.Caption
End Sub
Sub ClrTxt()For i = 0 To 4
Text1(i).Text = ""
Next i
TreeView1.Nodes.Clear ' clears all the text fields.End SubPrivate Sub Timer1_Timer()
Call WinsockStatus 'current winsock Status.
End SubPrivate Sub Timer2_Timer()Call GetStuff 'continally polls the server to see if the ADO service is enabled
Timer2.Enabled = False
End SubPrivate Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
SendData TreeView1.SelectedItem.Text 'Sends the Current User to the Server for Database lookup.
End SubPrivate Sub UserSock_DataArrival(ByVal bytesTotal As Long)
Dim getresults As StringUserSock.GetData getresults 'Main provider of retrieving all data.If getresults = "ADO-True" Then
ServerStatus = ServerStatus & vbNewLine & "ADO Services Have been Started."
Label4.Caption = ServerStatus
ADOEnabled = True 'Ado is avialable to access
Call GetUsersElse
If getresults = "ADO-False" Then
ServerStatus = "Server Status:" & vbNewLine & "ADO Services Are Closed."
Label4.Caption = ServerStatus
Timer2.Enabled = True
ADOEnabled = False
Else
Call ProcessResults(getresults) ' this processes all the incomming data from the server
End If: End IfEnd Sub
---------------------
Attribute VB_Name = "ServerMod"
Sub ServerSck()If Form1.ServerSock(0).State = sckConnected Then Form1.Label2.Caption = "Network Status: Connection Established"
If Form1.ServerSock(0).State = sckClosed Then Form1.Label2.Caption = "Network Status: Connection Closed"End SubSub SendData(Qry As String)
On Error Resume Next
Dim i As Integer
For i = 0 To 10
DoEvents
Form1.ServerSock(i).SendData QryNext iEnd Sub
Sub GenerateSQL(Var As String)
Dim Qry As String
Set rs = New ADODB.RecordsetQry = "Select * from users where name = " & Chr(34) & Var & Chr(34) 'Simply goes to the record that i client requestedrs.Open Qry, cn, adOpenKeyset, adLockReadOnlySendData "QRYNAME" & rs!Name & "QRYNAME" & rs!Address & "QRYNAME" & rs!Location & "QRYNAME" & rs!Comments & "QRYNAME"
'make sure you add "QRYNAME" to the end of the list as it saves errors.
rs.CloseSet rs = Nothing
End Sub
Sub SaveChanges(bit1 As String, bit2 As String, bit3 As String, bit4 As String)
If bit1 = "" Then Exit Sub
Set rs = New ADODB.Recordset
Dim Qry As StringQry = "Select * from users where name = " & Chr(34) & bit1 & Chr(34) 'this procedure does all the hardwork in saving
rs.Open Qry, cn, adOpenKeyset, adLockOptimistic 'any updates to the recordset.If Len(bit1) Then rs!Name = bit1 Else rs!Name = Null
If Len(bit2) Then rs!Address = bit2 Else rs!Address = Null
If Len(bit3) Then rs!Location = bit3 Else rs!Location = Null
If Len(bit3) Then rs!Comments = " " & bit4 Else rs!Comments = ""
rs.Update
rs.Close
Set rs = Nothing
End SubSub DelRecord(Record As String)
If Record = "" Then Exit SubSet rs = New ADODB.Recordset
Dim Qry As String
Qry = "Select * from users where name = " & Chr(34) & Record & Chr(34)
rs.Open Qry, cn, adOpenKeyset, adLockOptimistic rs.Delete 'this deletes the record selected by the client machine.
rs.Update
rs.Close
Set rs = Nothing
End Sub
Sub AddUser(String1 As String, String2 As String, String3 As String)
If String1 = "" Then Exit SubSet rs = New ADODB.Recordset
Dim Qry As String
Qry = "Select * from users "
rs.Open Qry, cn, adOpenKeyset, adLockOptimistic
rs.AddNew 'add the new user to the databasers!Name = String1
rs!Address = String2
rs!Location = String3
rs.Update
rs.Close
Set rs = Nothing
End Subodbc.bas
------------------
Attribute VB_Name = "ODBC"
Public cn As ADODB.Connection
Public rs As ADODB.Recordset
frmserver.frm(1)
----------------------
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5430
ClientLeft = 60
ClientTop = 345
ClientWidth = 6165
LinkTopic = "Form1"
ScaleHeight = 5430
ScaleWidth = 6165
StartUpPosition = 3 'Windows Default
Begin VB.ListBox List1
Height = 2985
Left = 120
TabIndex = 4
Top = 2280
Width = 6015
End
Begin VB.Timer Timer1
Interval = 500
Left = 5640
Top = 4800
End
Begin VB.Frame Frame1
Caption = " Server Status:"
Height = 1935
Left = 120
TabIndex = 0
Top = 120
Width = 6015
Begin VB.CommandButton CmdDisc
Caption = "Disconnect"
Enabled = 0 'False
Height = 495
Left = 4080
TabIndex = 5
Top = 840
Width = 1815
End
Begin VB.CommandButton CmdStart
Caption = "Start ADO Services"
Height = 495
Left = 4080
TabIndex = 1
Top = 240
Width = 1815
End
Begin VB.Label Label2
Caption = "Label2"
Height = 1215
Left = 120
TabIndex = 3
Top = 480
Width = 3855
End
Begin VB.Label Label1
Caption = "Label1"
Height = 255
Left = 120
TabIndex = 2
Top = 240
Width = 3135
End
End
Begin MSWinsockLib.Winsock ServerSock
Index = 0
Left = 6240
Top = 120
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
----------------------
'Written by Chris Hatton in VB 6.0.
'This is a simple example of using Winsock Client to View parts of a Microsoft Access
'database on a local machine with out having any Database Objects installed.
'Be sure to include in your project references the Microsoft
'ActiveX Data Objects 2.5 Library.
'Feel free to email me with your comments or suggestions. [email protected]
Dim MaxID As Long
Dim ADO As BooleanPrivate Sub CmdDisc_Click()
On Error Resume Next
cn.Close
Call SendAllSorts
ServerSock(MaxID).Close
Set cn = NothingLabel1.Caption = "Database Status: Disconnected"
Label2.Caption = "Network Status: Disconnected"
CmdStart.Enabled = True
CmdDisc.Enabled = False
SendData "ADO-False" 'tells the client that the ADO Service is down
End SubPrivate Sub CmdStart_Click()Set cn = New ADODB.Connection
Set rs = New ADODB.RecordsetOn Error GoTo OpenErrcn.Provider = "Microsoft.Jet.OLEDB.4.0"
Label1.Caption = "Loading Database"
cn.Open App.Path & "\Contacts.mdb", admin 'opens the database
Label1.Caption = "Database Status: Connected"
CmdDisc.Enabled = True
CmdStart.Enabled = False
ADO = True
Exit Sub
OpenErr:Label1.Caption = "Error Opening Database" 'if theres an error we need to know about it.MsgBox Err.Description, vbCriticalEnd SubPrivate Sub Form_Load()
ServerSock(0).LocalPort = 9456
ServerSock(0).ListenLabel1.Caption = "Database Status: "
Label2.Caption = "Network Status: Not Connected"End SubPrivate Sub Form_Unload(Cancel As Integer)
On Error Resume Next
cn.Close
ServerSock(MaxID).Close
End SubPrivate Sub ServerSock_ConnectionRequest(Index As Integer, ByVal requestID As Long)
MaxID = MaxID + 1 '
Load ServerSock(MaxID) '
ServerSock(MaxID).LocalPort = 0 '
ServerSock(MaxID).Accept requestID 'for every new connection made, lets load up a new winsock control
If ServerSock.Item(MaxID).Protocol = 0 Then ProtocolType = "TCP Connection" Else ProtocolType = "UDP Connection"If ServerSock.Item(MaxID).State = sckConnected Then
Form1.Label2.Caption = "Network Status: Connection Established " & vbNewLine & vbNewLine & "Remote IP: " & ServerSock(MaxID).RemoteHostIP & _
vbNewLine & "Remote Port: " & ServerSock(MaxID).RemotePort & vbNewLine & ProtocolType
CmdDisc.Enabled = True
End IfEnd SubPrivate Sub ServerSock_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim GetRecieve As String
Dim RecieveQry As String
Dim RecieveSave(4) As String
Dim RecieveDel As String
Dim RecieveAdd(3) As String
Dim Rqry As IntegerServerSock(MaxID).GetData GetRecieve 'get the incomming data from the client
List1.AddItem "User: " & ServerSock(MaxID).RemoteHostIP & " Getting info: " & GetRecieve 'add it to the server list
If GetRecieve = "$RemoteSTARTUP" Then CmdStart = True 'enables the client to activate the ADO Services remotelyIf GetRecieve = "GetUsers" Then ' send the client the list of users
List1.Clear
Call ListUsers 'this does all the hardwork of getting the users to a string.
End IfIf GetRecieve = "GetStuff" Then 'Sends the client other stuff such as the Ado Service status.
List1.Clear
Call SendAllSorts
Exit Sub
End IfOn Error Resume Next 'heaps of error in this script can't be bothered sorting it out.Rqry = InStr(RecieveQry, "$") ' compares the string to see if it is a Query that the user is wanting, and sends the details
' this keeps the data recieved Unique from the rest
If Rqry >= 0 Then
RecieveQry = Split(GetRecieve, "$")(1) 'simply splits the "$" from the contact name
GenerateSQL RecieveQry 'now that we have the Contact Name in one piece query the database
End If
For i = 1 To 4
RecieveSave(i) = Split(GetRecieve, "%")(i) 'a unique idenifier
'this saves all text field data to the database
Next i '
'
SaveChanges RecieveSave(1), RecieveSave(2), RecieveSave(3), RecieveSave(4) 'save it all
RecieveDel = Split(GetRecieve, "$~")(1) 'another unique idenifier, when this one recieved
DelRecord RecieveDel 'from the client, we know we want to delete this data
For i = 1 To 3 RecieveAdd(i) = Split(GetRecieve, "~~")(i) 'New User wanting to be added
Next i
AddUser RecieveAdd(1), RecieveAdd(2), RecieveAdd(3) 'new record is currently added
End SubSub SendAllSorts()
If ADO = True Then SendData "ADO-True" Else SendData "ADO-False"
End Sub
Private Sub Timer1_Timer()
Call ServerSck
End SubSub ListUsers()
On Error GoTo ListErr
Set rs = New ADODB.Recordset
Dim i As Integer
Dim j As Long
Dim SQLQry, strNames As String 'this procedure simple gets all the users
'from the databaseSQLQry = "Select Name from users"rs.Open SQLQry, cn, adOpenKeyset, adLockReadOnlyj = rs.RecordCountFor i = 1 To j
strNames = strNames & rs!Name & "-"rs.MoveNext
Next iSendData strNamesrs.Close
Set rs = Nothing
Exit SubListErr:
Exit SubEnd Sub
-------------
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1
Caption = "FrmClient"
ClientHeight = 5970
ClientLeft = 60
ClientTop = 345
ClientWidth = 9720
LinkTopic = "Form1"
ScaleHeight = 5970
ScaleWidth = 9720
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton CmdADO
Caption = "Start ADO"
Height = 375
Left = 4920
TabIndex = 18
ToolTipText = "Starts the ADO Service on the server"
Top = 5520
Width = 1215
End
Begin VB.Timer Timer2
Left = 7680
Top = 4800
End
Begin MSComctlLib.ImageList ImageList1
Left = 8640
Top = 4680
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 22
ImageHeight = 21
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmClient.frx":0000
Key = ""
EndProperty
EndProperty
End
Begin VB.Timer Timer1
Interval = 500
Left = 7200
Top = 4800
End
Begin VB.CommandButton CmdNew
Caption = "&New Contact"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 14
Top = 960
Width = 1335
End
Begin VB.Frame Frame2
Caption = "Services"
Height = 2415
Left = 4920
TabIndex = 13
Top = 120
Width = 4695
Begin VB.Label Label4
BorderStyle = 1 'Fixed Single
Caption = "Server Status:"
Height = 1335
Left = 120
TabIndex = 15
Top = 960
Width = 4455
End
End
Begin MSWinsockLib.Winsock UserSock
Left = 240
Top = 5520
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.CommandButton CmdDel
Caption = "Delete"
Height = 375
Left = 960
TabIndex = 12
Top = 5520
Width = 1215
End
Begin VB.CommandButton CmdExit
Cancel = -1 'True
Caption = "Exit"
Height = 375
Left = 2280
TabIndex = 11
Top = 5520
Width = 1215
End
Begin VB.CommandButton CmdSave
Caption = "&Save"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3600
TabIndex = 10
Top = 5520
Width = 1215
End
Begin VB.TextBox Text1
Height = 2655
Index = 4
Left = 120
MultiLine = -1 'True
TabIndex = 9
Text = "FrmClient.frx":05E8
Top = 2640
Width = 4695
End
Begin VB.TextBox Text1
Height = 285
Index = 3
Left = 1800
TabIndex = 5
Text = "Text4"
Top = 2160
Width = 3015
End
Begin VB.TextBox Text1
Height = 285
Index = 2
Left = 1800
TabIndex = 4
Text = "Text3"
Top = 1800
Width = 3015
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 285
Index = 1
Left = 1800
TabIndex = 3
Text = "Text2"
Top = 1440
Width = 3015
End
Begin VB.Frame Frame1
Caption = " Network Connection "
Height = 735
Left = 120
TabIndex = 0
Top = 120
Width = 4695
Begin VB.CommandButton CmdConnect
Caption = "Connect"
Height = 375
Left = 2760
TabIndex = 2
Top = 240
Width = 1695
End
Begin VB.TextBox Text1
Height = 285
Index = 0
Left = 120
TabIndex = 1
Text = "Text1"
ToolTipText = "Enter Server IP Address"
Top = 240
Width = 2295
End
End
Begin MSComctlLib.TreeView TreeView1
Height = 2655
Left = 4920
TabIndex = 17
Top = 2640
Width = 4695
_ExtentX = 8281
_ExtentY = 4683
_Version = 393217
Style = 7
ImageList = "ImageList1"
Appearance = 1
End
Begin VB.Label Label5
Caption = "Label5"
Height = 255
Left = 1800
TabIndex = 16
Top = 1000
Width = 2895
End
Begin VB.Label Label3
Caption = "Location:"
Height = 255
Left = 120
TabIndex = 8
Top = 2160
Width = 1575
End
Begin VB.Label Label2
Caption = "Address:"
Height = 255
Left = 120
TabIndex = 7
Top = 1800
Width = 1575
End
Begin VB.Label Label1
Caption = "Name:"
Height = 255
Left = 120
TabIndex = 6
Top = 1440
Width = 1575
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
可问题是服务器端的老板可能不会让我放入这个 server 进去啊!!
可不可以用 rds 啊????就像ADO 那么简单的????
再次谢谢 巴顿 !!!
我建议你用Soap,但不知如何实现!
我可以帮助你再找找!
我的数据量很小很小,正因为小我才用access 不然我不会这么做了。你说的 SOAP ,我没见到过啊,可不可以给我一个例子??这个问题搁了几天了啊,如果不行我真的只能用asp了。但我不想用asp啊,急切等待!!
如果要源代码当然也可以贴出来!
不过再看看其它人的办法吧!
为什么不用RDS?简单又省事?
现在最后一个办法了。可还是有问题!!以下代码可以通过
Private Sub Command6_Click()
Dim myrds As New RDS.DataControl
Dim myrs As ADODB.Recordset
myrds.server = "http://192.168.0.99"
myrds.connect = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" + "c:\Inetpub\wwwroot\db\gonow.mdb;pwd=1860"
myrds.SQL = "select * from users"
myrds.ExecuteOptions = adcExecSync
myrds.Refresh
Set myrs = myrds.Recordset
MsgBox myrs(2)
End Sub192.168.0.99 是我自己机器的IP,可只要我一改变其它IP 就会报错
如果将 myrds.server = "http://192.168.0.99" 改为
myrds.DataSpace = "http://192.168.0.1" 提示找不到数据库??那还叫什么 rds 啊!!!??哪里有错!!!!???????我晕了!!
现在最后一个办法了。可还是有问题!!以下代码可以通过
Private Sub Command6_Click()
Dim myrds As New RDS.DataControl
Dim myrs As ADODB.Recordset
myrds.server = "http://192.168.0.99"
myrds.connect = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" + "c:\Inetpub\wwwroot\db\gonow.mdb;pwd=1860"
myrds.SQL = "select * from users"
myrds.ExecuteOptions = adcExecSync
myrds.Refresh
Set myrs = myrds.Recordset
MsgBox myrs(2)
End Sub192.168.0.99 是我自己机器的IP,可只要我一改变其它IP 就会报错
如果将 myrds.server = "http://192.168.0.99" 改为
myrds.DataSpace = "http://192.168.0.1" 提示找不到数据库??那还叫什么 rds 啊!!!??哪里有错!!!!???????我晕了!!