Click here to Skip to main content
15,845,036 members
Home / Discussions / C#
   

C#

 
GeneralRe: .NET Collections - Capacity Pin
Jason Christian26-Apr-11 9:13
Jason Christian26-Apr-11 9:13 
AnswerRe: .NET Collections - Capacity Pin
AspDotNetDev25-Apr-11 12:10
protectorAspDotNetDev25-Apr-11 12:10 
GeneralRe: .NET Collections - Capacity Pin
Charvak Karpe28-Apr-11 4:47
Charvak Karpe28-Apr-11 4:47 
QuestionHow Can i Create A Class Library For MSACCESS database Connection Pin
Arunkumar.Koloth24-Apr-11 20:03
Arunkumar.Koloth24-Apr-11 20:03 
AnswerRe: How Can i Create A Class Library For MSACCESS database Connection Pin
Tarakeshwar Reddy24-Apr-11 20:13
professionalTarakeshwar Reddy24-Apr-11 20:13 
AnswerRe: How Can i Create A Class Library For MSACCESS database Connection Pin
Richard MacCutchan24-Apr-11 23:02
mveRichard MacCutchan24-Apr-11 23:02 
AnswerRe: How Can i Create A Class Library For MSACCESS database Connection Pin
PIEBALDconsult25-Apr-11 4:01
mvePIEBALDconsult25-Apr-11 4:01 
AnswerRe: How Can i Create A Class Library For MSACCESS database Connection Pin
ambarishtv28-Apr-11 7:27
ambarishtv28-Apr-11 7:27 
Hi Arun
Try this

using System;
using System.Collections.Generic;
using System.Text;
using System.Data.OleDb;
namespace Access
{
   public class Connection
    {
        private string getConnectionString()
        {
            return "connetionString";
        }

        public static void ExecuteCommand(string command)
        {
            OleDbConnection con;
            OleDbCommand com;
            try
            {
                con = new OleDbConnection(getConnectionString());
                con.Open();
                com = new OleDbCommand(command);
                com.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                //ex shows exception
            }
            finally
            {
                con.Close();
            }
        }
    }



//Call Connection Method<br />
        public void MyMethord()<br />
        {<br />
            Connection.ExecuteCommand("command write here");<br />
        }

-ambarish-

QuestionListBox.PreferredSize.Width interesting event Pin
msn9224-Apr-11 5:33
msn9224-Apr-11 5:33 
AnswerRe: ListBox.PreferredSize.Width interesting event Pin
DaveyM6924-Apr-11 13:30
professionalDaveyM6924-Apr-11 13:30 
QuestionArray Pin
messages23-Apr-11 2:40
messages23-Apr-11 2:40 
AnswerRe: Array Pin
David198723-Apr-11 3:15
David198723-Apr-11 3:15 
GeneralRe: Array Pin
messages23-Apr-11 3:20
messages23-Apr-11 3:20 
GeneralRe: Array Pin
David198723-Apr-11 4:08
David198723-Apr-11 4:08 
AnswerRe: Array Pin
OriginalGriff23-Apr-11 9:23
mveOriginalGriff23-Apr-11 9:23 
GeneralRe: Array Pin
Prasanta_Prince23-Apr-11 19:52
Prasanta_Prince23-Apr-11 19:52 
GeneralRe: Array Pin
messages23-Apr-11 20:56
messages23-Apr-11 20:56 
GeneralRe: Array Pin
David198723-Apr-11 21:04
David198723-Apr-11 21:04 
GeneralRe: Array Pin
OriginalGriff23-Apr-11 22:17
mveOriginalGriff23-Apr-11 22:17 
GeneralRe: Array Pin
messages23-Apr-11 20:54
messages23-Apr-11 20:54 
AnswerRe: Array Pin
Abhinav S25-Apr-11 2:29
Abhinav S25-Apr-11 2:29 
AnswerRe: Array Pin
ambarishtv28-Apr-11 7:36
ambarishtv28-Apr-11 7:36 
QuestionGZipStream ends too early Pin
Paladin200022-Apr-11 11:09
Paladin200022-Apr-11 11:09 
AnswerRe: GZipStream ends too early Pin
Andrew Rissing22-Apr-11 16:55
Andrew Rissing22-Apr-11 16:55 
GeneralRe: GZipStream ends too early Pin
Paladin200025-Apr-11 4:43
Paladin200025-Apr-11 4:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.