Results 1 to 5 of 5

Thread: save into server

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2009
    Posts
    25

    save into server

    i have two computers network connected....one is com1 and other is com2...
    i m using com1..if i save then i want to store in only in com2..and when i open from another computer the database frm com2 should be displayed from com1...
    Code:
     Dim cn As New SqlConnection("server=localhost;database=attendance1;uid=sa;password=;")
    i think just the declaration would do that...but i m not doint that...can anyone help me..thanks

  2. #2
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    Re: save into server

    I really doesn't understand what you're saying?!

    Rate People That Helped You
    Mark Thread Resolved When Resolved

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2009
    Posts
    25

    Re: save into server

    i m using com1...if i use program from com2 then i dn get the record saved from com1...

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: save into server

    As the name suggests, when you specify "localhost" as the server you are referring to the local machine. If you want to refer to a SQL Server instance on a different machine then you have to specify the name of that machine as the server in h the connection string.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    Re: save into server

    You're saying that you'll have an application in several machines, and when you save the data in one of them, that data will be available for everyone?

    If it's that, the connection string can't be refered as localhost, it must be something like this:
    VB.NET Code:
    1. Data Source=IP\SQLINSTANCENAME;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

    Rate People That Helped You
    Mark Thread Resolved When Resolved

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