Page 1 of 2 12 LastLast
Results 1 to 40 of 48

Thread: [RESOLVED] How to use other pc dsn

  1. #1

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Resolved [RESOLVED] How to use other pc dsn

    Hi all
    I have to pc i make a pc as a server and using database in it
    But i want that from second pc i can able to excess database that is on the first pc.......
    how it is possible

    help urgent!
    Last edited by shakti5385; Jul 25th, 2006 at 12:29 AM.

  2. #2
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to use other pc dsn

    What database are you using?
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  3. #3

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    thanks for reply
    i am using ms excess

  4. #4
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to use other pc dsn

    I wouldn't use MS-Access as a centralized database. I woudl rather choose SQL Server.

    Anyways you will have to share the folder where MS-Access database is and you can then use that shared folder to reference the access database from anywhere on your network.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  5. #5

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    can u tell me in brief what is the concept

  6. #6
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to use other pc dsn

    Follow the same steps as yyou would follow while creating the DSN on a System and when you need to select the MDB file, goto the shared folder and then select the MDB file you have kept on the server.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  7. #7

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    VB Code:
    1. Error(-2147467259):[Microsoft][ODBC Microsoft Access Driver] Operation must use an updatable query
    Above error is occuring when i am saving the data in the second PC that contain data base that is on the first pc
    I make a dsn on the first pc and i am accessing the database on the second pc using the first pc dsn
    above error is occuring at here
    VB Code:
    1. rs.update
    what is the reason?

  8. #8
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to use other pc dsn

    Is the database (the mdb file) readonly?
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  9. #9

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    no is is not read only.......

  10. #10
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to use other pc dsn

    And one more thing, why not just use a simple connectionstring to connect to the database rather than a DSN. It will be easier.

    Is the folder in which the mdb file is present read-only? Or do you have read-only access to the shared folder?
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  11. #11

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    folder is not read only
    also database is not read only............

    and using connection string how i connect the database that is on the other pc ....?
    can u have any code.......

    thanks

  12. #12
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to use other pc dsn

    VB Code:
    1. Dim cnDB As ADODB.Connection
    2. Set cnDB = New ADODB.Connection
    3. cnDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\ServerName\ShareName\MDBname"
    Servername is the name of the server where you have the MDB file, ShareName is the name of the Shared Folder and MDBName is the name of the MDB file.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  13. #13

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    just i am checking.............
    thnaks

  14. #14

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    using you code error occuring that database r folder is read only....
    what i do..........
    Thnaks

    error is here
    VB Code:
    1. rs.update

  15. #15
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: How to use other pc dsn

    Make the folder that the mdb file is in not read only (Properties - down at the bottom). Also, in the Sharing tab, in Permissions, give Everybody Full permission.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  16. #16

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Question Re: How to use other pc dsn

    @Shuja Ali completed successfully.........
    Now give me an idea that there are five pc and five pc sharing the database ....
    i want to know that who is currently sharing the database as a server........
    thanks shuja ali
    Your idea are great

    @ Al42
    thanks 4 suggession.... i get this problem sulution........

  17. #17

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    @ shuja Ali
    Please chek it again

  18. #18
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: How to use other pc dsn

    You can't use another pc's DSN. It best to code your app using a DSN-Less connection and you will not have to bother with this problem at all.

  19. #19
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to use other pc dsn

    Quote Originally Posted by shakti5385
    Now give me an idea that there are five pc and five pc sharing the database ....
    i want to know that who is currently sharing the database as a server........
    I did not understand completely, do you want to know which PC is currently sharing the MDB file?
    If that is what you are looking for then you will have to write a function that will search the network for all the shared folders and then check if the MDB file is in any of the shared folders.

    But IMHO, this should not be done, you might probably rethink about what you are trying to do. If you want to have a centralized database then it should be kept only at one place and then all the other PCs should be accessing the data from this database.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  20. #20

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    I did not understand completely, do you want to know which PC is currently sharing the MDB file?
    ServerPC is sharing the database.........
    I did not understand completely, do you want to know which PC is currently sharing the MDB file?
    Server contain the main database and p1,p2,p3 sharing the server database........

    but at a server sight i(server only) want to know that at a time who is accessing the database.........

    any idea for it!

    Thanks for reply

  21. #21
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to use other pc dsn

    The easiest way would be to read the LDB file that will be present in the same folder as the MDB file and read the contents. This file will contain the name of the PC and the User who is using the database.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  22. #22

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    VB Code:
    1. read the LDB file
    How to do this?
    How to show on a form on a command button click that who is accessing the database
    .......
    Thanks 4 reply

  23. #23

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    i click on the mdb file but message show that windows can not open this file..........

    The how to read it?

  24. #24
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: How to use other pc dsn

    or just use ASP on the server with an ASP page that is requested and info sent back and forth .. but then you will need to know some ASP ..

  25. #25

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    or just use ASP on the server with an ASP page that is requested and info sent back and forth .. but then you will need to know some ASP ..
    i do not know ASP

  26. #26
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to use other pc dsn

    Open it using Notepad.

    And in VB code you can do something similar to this
    VB Code:
    1. Dim sLine As String
    2.     Open "C:\db1.ldb" For Input As #1
    3.     Line Input #1, sLine
    4.     Debug.Print sLine
    5.     Close #1
    This just an example, the actual implementation will depend on what you are going to do with the data that is present in the File.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  27. #27

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    @Shuja Ali
    Great Code........

    But Problem Is that is is showing on pc name two time..........
    and showing admin there but there is no admin pc name..........

    guide me


    thanks

  28. #28
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to use other pc dsn

    Thats the information that you will get from that file.

    Do you want to display in the application who is accessing the database? If so then just use Environ("Username") in the code to get the username who is accessing the application currently.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  29. #29

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    Do you want to display in the application who is accessing the database?
    ya i want to display in a list box

    If so then just use Environ("Username") in the code to get the username who is accessing the application currently.
    Not understand tell in brief...
    thanks

  30. #30

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    I m checking the username and try to saving it in the database in a table,,,,,
    but it is not saving error occuring that field is to small or long how to do this,...
    please check this code

    VB Code:
    1. Public Sub Check_Who_Is_Using_This_Software()
    2. TSQL = ""
    3. PC_Name = LocalHostName()  'Function giving the machine Name
    4. IP_Address = IPAddressFromHostName(PC_Name)  'Function givinfg the ip address
    5. TSQL = ""
    6. TSQL = "select * from pc where pcname='& Trim(PC_Name) &'"
    7. Set RTMP = Get_Special_Record_Set(TSQL)
    8. If RTMP.BOF = True And RTMP.EOF = True Then
    9. RTMP.AddNew
    10.     RTMP!pcname = RTrim(PC_Name)' Error occuring here why not saving :confused:  the machine name as string
    11.     RTMP!ip = Trim(IP_Address)
    12. RTMP.Update
    13. Else
    14.     RTMP!pcname = Trim(PC_Name)
    15.     RTMP!ip = Trim(IP_Address)
    16. RTMP.Update
    17. End If
    18.  
    19. End Sub

    Thanks
    Please check both post
    Last edited by shakti5385; Jul 20th, 2006 at 03:22 AM.

  31. #31

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    @shuja Ali
    Post 30 slovedby me

    can u tell me sonthing about post 29

    thanks

  32. #32
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to use other pc dsn

    What is the error message that you are getting?
    If all you need is to display the username in the application then just use
    VB Code:
    1. Environ$("USERNAME")
    to get the Username and put it in the listbox.

    Or do you want to show it to other users also?
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  33. #33

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    Or do you want to show it to other users also?
    yes i want to show all user at server pc......

    thanks 4 reply

  34. #34
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to use other pc dsn

    Quote Originally Posted by shakti5385
    yes i want to show all user at server pc......

    thanks 4 reply
    Then have a table that will store the Usernames who are accessing the database and then query that table using the application on the server.

    Although this is not a reliable solution but this is the easiest one to implement.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  35. #35

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    I am savin all the user name in the table when they log in
    and i will delete the user name from the table when they log out...
    is this concept is correct

    thanks

  36. #36
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to use other pc dsn

    That sounds ok.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  37. #37

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    @ Shuja Ali
    Thanks a lot for ur great guidence.....
    I am not able to rate ur post this time due to some vb forums rules......

    Please wait i m send u a image.....

  38. #38

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    @Shuja ali

    Please check this image

    i done it in ur guidence.....

    Please keeping guide me


    Thanks a lot


    if u have any idea abot my post run in back ground then please tell me....


    shakti.....


    [SIZE=7]Thanks a lot[/SIZE]
    Attached Images Attached Images  

  39. #39

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to use other pc dsn

    Although this is not a reliable solution but this is the easiest one to implement.
    Why it is not reliable solution and what is the relaible solution?

    thanks

  40. #40
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to use other pc dsn

    It is not reliable because What if the system shuts down while your application is still running, your server will still show that user is connected and things similar to that.

    I am also searching for a reliable solution
    Use [code] source code here[/code] tags when you post source code.

    My Articles

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width