Results 1 to 13 of 13

Thread: How to connect a login form in windows application to remote server...????

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    11

    Question How to connect a login form in windows application to remote server...????

    Hi Everyone,

    I am having trouble in creating a login form in my windows application.
    If i create a login form with its database local to the system ,it works fine .

    But my requirement is that the database is placed on a remote server so that the login is secured.
    When the user tries to use the application he first needs to login.
    When he puts the username and password in the login form it should send the data to a remote server for authentication.
    Please help me how to do the needful.

    Thanks in advance

    Regards
    Aryan

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

    Re: How to connect a login form in windows application to remote server...????

    So basically you don't know how to connect to the database, right? A query is a query, whether it's for the purpose of logging in or whatever. I suggest that you visit www.connectionstrings.com and check out the appropriate connection string format for your database.
    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

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    11

    Re: How to connect a login form in windows application to remote server...????

    Hi jmcilhinney,
    Thanks for your reply.

    If in a windows application the database and the application are in the same PC...in that case I know how to connect to database but my problem is that if the database is on a remote server or say a different PC and your application is on a different PC ..than I don't have an idea what should be the connection string.


    Regards
    Aryan

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

    Re: How to connect a login form in windows application to remote server...????

    That would explain why I directed you to a site that will show you what the connection string would be.
    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

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    11

    Re: How to connect a login form in windows application to remote server...????

    Hi

    I had seen that website before also..

    I am confused between two connection strings ....

    1 ) Connect via an IP address :

    Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

    2) Attach a database file on connect to a local SQL Server Express instance :

    Server=.\SQLExpress;AttachDbFilename=c:\mydbfile.mdf;Database=dbname; Trusted_Connection=Yes;


    I mean i am using SQL server 2005 express edition Please explain me how to host the database on the server ...
    Do i need to configure the DSN ???

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

    Re: How to connect a login form in windows application to remote server...????

    That second option says:
    Attach a database file on connect to a local SQL Server Express instance
    You specifically stated that the database will be on a remote system, not the local system, so how can that even be in consideration?
    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

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    11

    Re: How to connect a login form in windows application to remote server...????

    Hi

    Yes you are absolutely right ....second option is used when the database file is on the local system...I have always used this to connect a database to the windows application.

    But while using this string we provide the the name of the server i.e .\SQLExpress

    In case of remote server we are just providing the IP and port ...not the name of the server .....
    that means we need to configure DSN on the server ???? Like we do in Java Servlets ?????

    And also i don't know what is Network Library for in this String ????

    Regards
    Aryan

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

    Re: How to connect a login form in windows application to remote server...????

    This:
    Code:
    .\SQLExpress
    is of the standard form "MachineName\InstanceName". In this case and many others, the dot stands for the local machine, so that you don't have to change the value as you move from machine to machine. In SQL Server parlance that is equivalent to:
    Code:
    (local)\SQLExpress
    or you can specify the local machine explicitly, which, in my case, would look like this:
    Code:
    Dylan\SQLExpress
    If you want to use an instance on a different machine on the same network then you simply provide the name of that machine instead of the local one.
    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

  9. #9

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    11

    Re: How to connect a login form in windows application to remote server...????

    Hi

    Thanks for your instant replies...
    ....If I understood you correctly ....in my case i can replace the name by the IP of the remote server ??? right ????

    Regards
    Aryan

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

    Re: How to connect a login form in windows application to remote server...????

    Try it for yourself and see.
    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

  11. #11

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    11

    Re: How to connect a login form in windows application to remote server...????

    Hi jmcilhinney..

    I tried to connect using this string

    Data Source=180.215.177.34,1433\SQLExpress;Network Library=DBMSSOCN;Database=login; Trusted_Connection=Yes

    Was getting an error message....

    I even followed steps mentioned on this page

    http://support.microsoft.com/kb/914277#method3

    But still getting the same error...Please help me...

    Regards
    Aryan

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

    Re: How to connect a login form in windows application to remote server...????

    Are you actually connecting over the internet or are the machines on the same LAN? If over the internet, is the instance configured to allow TCP connections?
    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

  13. #13

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    11

    Re: How to connect a login form in windows application to remote server...????

    Hi

    Yes i am connecting through Internet ......Machines are not on the same LAN.

    I have already configured instance to allow TCP connection ...I have configured according to the steps given on this page...http://support.microsoft.com/kb/914277#method3

    and
    http://blog.sqlauthority.com/2009/05...-server-error/

    but still getting the same error....

Tags for this Thread

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