-
February 5th, 2009, 10:19 PM
#1
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
-
February 5th, 2009, 10:38 PM
#2
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.
-
February 6th, 2009, 12:22 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|