|
-
Oct 29th, 2000, 01:53 AM
#1
Hi all
I am new in visual basic and am creating a application in visual basic which has a central database which is there in the server on the lan env. but how can i connect user to the server for accessing the database from the server from the terminal
how ? please help me out
thanks
-
Nov 2nd, 2000, 09:04 AM
#2
Member
There are a number of ways to connect to that database...
But Im gonna teach you something which I think would be best....
It depends on the database that you have... However, one thing is common, configuring windows' ODBC data sources, you can connect to any database on other machines, provided you have the drivers for those databases.... (are u familiar with windows ODBC?)...
Like Sybase's SQL Server Anywhere.. or Enterprise blah blah..... and so on and so forth, the danger is you might not have those drivers installed on the client. Each vendor has its own installer for this.
But if its an MS Access Database (*.MDB), windows has it by default. So you can easily configure ODBC on the client machine, to point to that database on the server. You then need DAO or ADO(I prefer ADO) to connect to the ODBC data source on the client machine. It will be the ODBC which will be responsible for connecting to the remote database(on the server).
Prerequisite: knowledge on ADO or DAO, knowledge on Configuring ODBC data sources on Windows...
I really hope this helps.
Programmers dont byte, they just nibble a bit.
-
Nov 2nd, 2000, 12:14 PM
#3
what kind of a database are you trying to connect to, anyway? you might want to try adding a data environment to your program. just hit Project, then Add Data Environment. Then right click on Connection1 and hit properties, and then alter the properties to your specifications.
Then you can use the Data View Window button to drag and drop the tables/queries that you need.
hope this helps.
-
Dec 13th, 2000, 04:11 AM
#4
New Member
I connect to an Access databases using the following code:
Public Function Gain_DB_Access()
On Error GoTo ErrorHandler
MyPath = CurDir
Set DB = DBEngine.Workspaces(0).OpenDatabase(MyPath & "\data\SAPChx.mdb", False, False, ";pwd=SaPcHxX")
ErrorHandler: ' Error-handling routine.
If Err.Number <> 0 Then
MsgBox ("Error " & Err.Number & " " & Err.Description & " occurred!")
Else
Exit Function
End If
End Function
+++++ Code above in my module +++++
+++++ Code below access the database +++++
Data3.DatabaseName = MyPath & "\data\SAPChx.mdb"
Data3.Refresh ' Open the Database.
Data3.Recordset.MoveFirst
t1_host = Data3.Recordset.Fields("T1_Host").Value
t2_host = Data3.Recordset.Fields("T2_Host").Value
Data3.Database.Close
Hope this helps.
-
Dec 13th, 2000, 10:09 AM
#5
Frenzied Member
1) Don't use ODBC to connect to an Access database, use the OLE-DB Provider instead.
2) Don't use DAO when you can use ADO.
3) If you are planning on more than 10 users to be accessing your database at once, don't use Access at all.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|