CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2008
    Posts
    67

    Regarding database connection

    I created a sample application which has a button called Save and an edit box .When i click the save button the text which i have entered in the edit box has to be stored in my server "rajesh", database- "testdb" and the table is "testtable".

    Also in some forums it has been said that we can use the following code.

    using namespace System;
    using namespace System:ata;
    using namespace System:ata::SqlClient;

    SqlConnection sqlConnection = new SqlConnection();
    sqlConnection.ConnectionString = connection_string;
    sqlConnection.Open();

    // do some operations ...
    // close the connection

    sqlConnection.Close();

    but for this whether i have to create the class sqlconnection or i should include from somewhere.
    Please let me know the procedure of how to access to a database.

    Thanks to all in advance

  2. #2
    Join Date
    Jul 2008
    Posts
    70

    Re: Regarding database connection

    You need to create the SQLConnection and set the connection string. The Connection string describes how to connect to any SQL database.

    http://www.connectionstrings.com/ is a great resource for connections strings.

    Give that a try and report back if you have any problems.

  3. #3
    Join Date
    Mar 2008
    Posts
    67

    Re: Regarding database connection

    Is there any possibility of using ADO Connection as i found that ADO MFC class library can be easily accessible....

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

Featured