Click here to Skip to main content
15,916,091 members
Home / Discussions / C#
   

C#

 
GeneralRe: Detect Marked Checkbox using OCR Pin
Zeyad Jalil22-Feb-12 20:29
professionalZeyad Jalil22-Feb-12 20:29 
GeneralRe: Detect Marked Checkbox using OCR Pin
enhzflep22-Feb-12 20:43
enhzflep22-Feb-12 20:43 
Questionsmtp unknown sender Pin
CS3421-Feb-12 23:23
CS3421-Feb-12 23:23 
AnswerRe: smtp unknown sender Pin
Richard MacCutchan22-Feb-12 3:14
mveRichard MacCutchan22-Feb-12 3:14 
Questionadd application to \\root\SecurityCenter2\antispywareproduct as antispyware Pin
abhinish21-Feb-12 23:12
abhinish21-Feb-12 23:12 
Questionhow can i scann image from scanner in C# Pin
A7mad_21-Feb-12 22:55
A7mad_21-Feb-12 22:55 
AnswerRe: how can i scann image from scanner in C# Pin
lukeer22-Feb-12 2:17
lukeer22-Feb-12 2:17 
Questiontrouble in connecting from C# to Postgre SQL. Pin
hellono121-Feb-12 20:46
hellono121-Feb-12 20:46 
Hi all.
I'm now developing a website that connect to Postgre SQL database. I used NpgSQL.DLL to connect from C# to database. I also finished testing this project in my local pc, it worked well. But unfortunately it did not work well in server. Some errors in connecting to server happened.
These errors happened when website had much people logged in and began using database query functions ( select, update, delete .. ). I think errors begin from codes in connect database functions. but i still can not fix it. this is my connecting database codes.
------ codes connects database ---------
C#
--  Connect.cs file.
public static void connectDB()
    {
        try
        {
                conn.ConnectionString = connection;
                conn.Open();
        }
        catch
        {
            //closeConnectDB();
        }
    }
    public static void closeConnectDB()
    {
        //conn.Dispose();
            conn.Close();
        //conn.Dispose();
    }
    public static int ExecuteQuery(string SQL)
    {
        try
        {
            connectDB();
            NpgsqlCommand cmd = new NpgsqlCommand(SQL, conn);
            return cmd.ExecuteNonQuery();
        }
        catch
        {
            closeConnectDB();
            return 0;
        }
        
    }

    public static DataSet SelectQuery(string SQL)
    {
        DataSet ds = new DataSet();
        try
        {
            connectDB();
            NpgsqlDataAdapter nDa = new NpgsqlDataAdapter(SQL, conn);
            
            nDa.Fill(ds);
            // closeConnectDB();
            return ds;
        }
        catch
        {
            closeConnectDB();
            return ds;
        }
        
    }


----------------- use to execute these codes --------

....

C#
--- calling functions files.
try
                        {
                            string strTest = "Select * from abc where .. ";
                            DataSet ds1 = new DataSet();
                            ds1 = Connect.SelectQuery(strTest);
                            if (ds1.Tables[0].Rows.Count > 0)
                            {
                                
                            }
                            else
                            {
                                int kq = Connect.ExecuteQuery(strInsert);
                                if (kq > 0)
                                {
                                    int kk = Connect.ExecuteQuery(strUpdate);
                                    kk = Connect.ExecuteQuery(strUpdate2);
                                    
                                    strHTML = "OK";
                                }
                            }
                        }
                        catch
                        {
                            strHTML = "errors.";
                        }
                        finally
                        {
                            int kk = Connect.ExecuteQuery(strUpdate);
                            kk = Connect.ExecuteQuery(strUpdate2);
                            
                            strHTML += "-- Sub Finally";
                        }


-----------------End calling function---------------
Here sometimes it worked well but sometimes catched errors.
Can you help me? thanks and regards.
AnswerRe: trouble in connecting from C# to Postgre SQL. Pin
BobJanova21-Feb-12 21:42
BobJanova21-Feb-12 21:42 
QuestionIntegration of .NET with retail billing machine Pin
tahernd21-Feb-12 19:14
tahernd21-Feb-12 19:14 
AnswerRe: Integration of .NET with retail billing machine Pin
Richard MacCutchan21-Feb-12 21:24
mveRichard MacCutchan21-Feb-12 21:24 
AnswerRe: Integration of .NET with retail billing machine Pin
Mycroft Holmes21-Feb-12 21:39
professionalMycroft Holmes21-Feb-12 21:39 
GeneralRe: Integration of .NET with retail billing machine Pin
tahernd22-Feb-12 0:26
tahernd22-Feb-12 0:26 
QuestionAny difference between Console App and Windows Service for HttpWebRequest..? [Solved] Pin
Paladin200021-Feb-12 6:38
Paladin200021-Feb-12 6:38 
AnswerRe: Any difference between Console App and Windows Service for HttpWebRequest..? Pin
jschell21-Feb-12 9:41
jschell21-Feb-12 9:41 
GeneralRe: Any difference between Console App and Windows Service for HttpWebRequest..? Pin
Paladin200021-Feb-12 10:10
Paladin200021-Feb-12 10:10 
AnswerRe: Any difference between Console App and Windows Service for HttpWebRequest..? Pin
Dave Kreskowiak21-Feb-12 15:08
mveDave Kreskowiak21-Feb-12 15:08 
GeneralRe: Any difference between Console App and Windows Service for HttpWebRequest..? Pin
Paladin200022-Feb-12 3:34
Paladin200022-Feb-12 3:34 
AnswerRe: Any difference between Console App and Windows Service for HttpWebRequest..? [Eureka!] Pin
Paladin200022-Feb-12 10:40
Paladin200022-Feb-12 10:40 
GeneralRe: Any difference between Console App and Windows Service for HttpWebRequest..? [Eureka!] Pin
jschell22-Feb-12 11:35
jschell22-Feb-12 11:35 
QuestionVisual Studio - Could not load file or assembly 'Microsoft MSXML' Pin
Michael Breeden21-Feb-12 6:27
Michael Breeden21-Feb-12 6:27 
AnswerRe: Visual Studio - Could not load file or assembly 'Microsoft MSXML' Pin
Eddy Vluggen21-Feb-12 10:15
professionalEddy Vluggen21-Feb-12 10:15 
GeneralNo help there Pin
Michael Breeden21-Feb-12 10:40
Michael Breeden21-Feb-12 10:40 
GeneralRe: No help there Pin
Eddy Vluggen21-Feb-12 10:59
professionalEddy Vluggen21-Feb-12 10:59 
AnswerWell, I solved it. Just install VS 2010 Express Pin
Michael Breeden21-Feb-12 15:42
Michael Breeden21-Feb-12 15:42 

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.