over 8 years ago
Below is the C sharp code to connect with the sql data base in .net
usingSystem.Data.Sql; usingSystem.Data.SqlClient;
// FUNCTION TO CONNECT TO THE SQL SERVER DATABASE
privatevoidconnectToSQLServer() {
// SQL CONNECTION REPRESENTS AN OPEN CONNECTION TO SQL SERVER DATABASE
SqlConnectionsqlConnection = newSqlConnection(connectionString);
//CONNECTION STRING IS STRING FOR CONNECTING TO THE SQL SERVER // e.g : "Data Source=servername;Initial Catalog=databasename;Integrated Security=True"
try { SqlCommandsqlCommand=newSqlCommand("Select * from tableName");// QUERY TO BE EXECUTED sqlConnection.Open();// OPEN SQL CONNECTION sqlCommand.Connection=sqlConnection; DataTabletableResult = newDataTable(); tableResult.Load(sqlCommand.ExecuteReader()) ;// RETURN RESULT OF QUERY } catch (Exception ex) { } finally {
// CLOSE SQL CONNECTION IF IT IS OPEN
if(sqlConnection!=null&&sqlConnection.State==ConnectionState.Open) sqlConnection.Close(); } }
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Sign up using
0 Comment(s)