Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8699297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:54:52+00:00 2026-06-13T01:54:52+00:00

I am New to the more enhanced features of the C# and .NET coding

  • 0

I am New to the more enhanced features of the C# and .NET coding practices

I have been trying to Find A solution to using a particular method in C# for Winforms, Windows Services And ASP.NET web Applications where you program your connection to SQL and Convert the C# Code file to a dll to be used in your project.

The idea is to Create the Connection and Convert it to a dll so that every time you start a function and need to make a database connection you will just write it where you say

Function ABC
{
    //VB Version would be like this as i have seen this
    Dim DCDLL as New Dataconn 

    //Where 'DCDLL' is the DLL file which is being declared as a new dataconnection

    //C# Version would be Alon these Lines
    SQLConnection DataConn = New SQLConnection(DCDLL)
}

I have only seen the VB Code version of the Call so I am not keen on the C# Method that this would be done

Meanwhile The DLL Holds all the other code like

string ConnectionString = 
                    "Data Source=Datasource; UID=User; PWD=Pass; Persist Security
                     Info=True; Initial Catalog= Catalog";
Dataconn = new SqlConnection(ConnectionString);
Dataconn.Open();

the purpose of the DLL would be to handle the connection to the database, Open it catch errors if dataconnection is not successfull and close the connection if needed so that you dont have to programatically do this every time. Also it is only responsible for the connection therefore you can use a function to call the connection execute the procedure and whatever else is required.

The idea of using a DLL is just to make the Connection settings to the Database a little more secure, the Connection obviously wont become super secure but it adds more security than having the Code in you code pages etc.

i have spoken to and seen people use this type of method but my research on how to achieve this via google and other sources does not seem to understand what i am searching for.

I am trying to understand that when i code this file how it must be done as to ensure that it handles the database connection correctly without issues and doesnt break.

If anyone can Give me Examples in C# of how to do this it would be appreciated or if you know of any pages that have explained how to achieve this i would be most grateful for your assistance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:54:53+00:00Added an answer on June 13, 2026 at 1:54 am

    You should put your connection strings in app.config / web.config, and use c# to get the values…

    Get ConnectionString from app.config in c#

    You can also encrypt the connection string…

    http://msdn.microsoft.com/en-us/library/89211k9b(v=vs.80).aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my new job more people are using Python than Perl, and I have
New to this library (no more familiar with BeautifulSoup either, sadly), trying to do
The new OS (3.0+) adds more features which speed up the development (like working
I read that the new delegate method can attach more than one event to
I am relatively new to using MSpec and as I write more and more
Maybe it has been asked somewhere, but I am trying to find my question
I'm new to workflow foundation. I'm trying to build a .NET 4 console application.
The new enhanced auth dialog also shows which of your friends are also using
I am trying to understand the new operator more closely. I do understand the
I'm trying to find an elegant OOP solution for the following problem. Assume we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.